Yeah, you see, the scope of your var 'number' is not what you think it is:
Code:
int test(int number)
{
number = 5;
return number;
}
'number' is only "seen" by this function as the parameter to the function.
Code:
result = test(number);
You never declared number as an int in 'main'. The correct code would be:
Code:
#include <stdio.h>
void main()
{
int test(int number); /* function prototype */
int i;
int result = 0;
int number;
result = test(number);
for(i = 0; i < 20; i++)
printf("\n %d \n %d \n\a", i, result);
}
int test(int number)
{
number = 5;
return number;
}
And to your second question, a pointer has to have an * for declaration and to get the value of the pointer.
--Garfield