Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6710225
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:59:49+00:00 2026-05-26T07:59:49+00:00

as I am starting to study at university we are learning how to write

  • 0

as I am starting to study at university we are learning how to write in C and we got to the point where I’ve learned that I can use pointers as function parameters but what they haven’t told us is how to get the value from it. I am not able as a person who doesn’t know about C as much, to come up with other solution than use two parameters (one as pointer to the variable and other as value. See the example which is not real code but it’s just for purpose of demonstration:


int main(int argc, char* argv []) {

     int a;
     addNumber(&a);


}

void addNumber(int * a) {
     *a = *a + 1; // this obviously does not work
}


Any input would be appreciated.
Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T07:59:50+00:00Added an answer on May 26, 2026 at 7:59 am

    Here is an example that may be closer to what you are looking for:

    #include <stdio.h>
    
    void increment(int *a, int *b)
    {
        *a = *a + *b;
    }
    
    int main(void)
    {
        int sum = 5;
        int increment_by = 7;
        printf("sum: %d, increment_by: %d\n", sum, increment_by);
        increment(&sum, &increment_by);
        printf("sum: %d, increment_by: %d\n", sum, increment_by);
    
        return 0;
    }
    

    output:

    $ ./bar
    sum: 5, increment_by: 7
    sum: 12, increment_by: 7
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Starting with a list of objects containing two parameters notional and currency, how can
I'm starting study opengl, and im tring to make a 3d chess like, but
I am starting to study map-reduce databases. How can one implement a reference in
I am starting study java2me. But I have some source study about it like
I am starting now to study Android. I came from iOS development. How can
i am starting to study FLEX. i have only flex sdk. So can i
Starting to use Nhibernate for persistency being seduced by the promise that it respects
My understanding is that it means that one can potentially write a program to
Starting a new project and would like to use one of the MVC framworks.
I have learned a Machine Learning course using Matlab as a prototyping tool. Since

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.