Originally Posted by
Player777
I do not understand your answer program should supposed to give result 3 but it's give error so how to get result 3
Try this program then:
Code:
#include <stdio.h>
int foo(void)
{
int x = 2; // we don't really need this, but as an example...
return x;
}
int main(void)
{
int x = foo();
x++;
printf("x = %d\n", x);
return 0;
}
or this one:
Code:
#include <stdio.h>
void foo(int *result)
{
*result = 2;
}
int main(void)
{
int x;
foo(&x);
x++;
printf("x = %d\n", x);
return 0;
}