Originally Posted by
shanwu
Well, the code I provided is a simplified version. I use printf() function to check in reality.
This is a test program based on your code:
Code:
#include <stdio.h>
void B(int *count)
{
*count = *count + 1;
}
void A(int *count)
{
*count = 0;
B(count);
}
int main(void)
{
int count;
A(&count);
printf("%d\n", count);
return 0;
}
I ran it and it prints 1. Therefore, contrary to your assertion in post #1, there is no problem with your code where changing the value of count in function B is concerned.