-
How about this one
int
Code:
#include <stdio.h>
int f(int* a, int* b);
int main() {
int a = 6, b = 7, c = 8;
b = f(&c, &a);
printf("a = %d, b = %d, c = %d\n", a, b, c);
return 0;
}
int f(int* a, int* b) {
*a = *a + *b;
*b = *a - *b;
printf("a = %d, b = %d\n", *a, *b);
return 3*(*b);
}
-
How about you read your previous thread again, and then post what YOU think is happening.
-
I got everything working right I just dont know how c=14 if theres no equation or anything given for it?
-
But there is. c is not modified in main, it's modified in f(). Remember, the address of c is passed as the first parameter to f().
-