错误在我调用 foo 的 main 行上的 int 之前表示预期的主表达式。我不明白以及如何解决它。我究竟做错了什么?
#include <stdio.h>
#include <stdlib.h>
int foo(int *a, int *b, int c) {
/* Set a to double its original value */
*a = *a * *a;
/* Set b to half its original value */
*b = *b / 2;
/* Assign a+b to c */
c = *a + *b;
/* Return c */
return c;
}
int main() {
/* Declare three integers x, y, z and initialize them to 5, 6, 7 respectively */
int x = 5, y = 6, z = 7;
/* Print the values of x, y, z */
printf("X value: %d\t\n", x);
printf("Y value: %d\t\n", y);
printf("Z value: %d\t\n", z);
/* Call foo() appropriately, passing x, y, z as parameters */
foo(int *x, int *y, int z);
/* Print the value returned by foo */
printf("Value returned by foo: %d\t\n", foo(x, y, z));
/* Print the values of x, y, z again */
printf("X value: %d\t\n", x);
printf("Y value: %d\t\n", y);
printf("Z value: %d\t\n", z);
/* Is the return value different than the value of z? Why? */
return 0;
}