hello.,
in a few examples i noticed that pointers are declared in functions parameter list.
ex
#include <stdio.h>
void SwapEm (char *p_grade1, char *p_grade2);
int main ()
{
char grade1= 'D', grade2 = 'A';
printf ("At the beginning grade1 is %c and grade2 is %c\n", grade1, grade2);
SwapEm (&grade1, &grade2);
printf ("At the end grade1 is %c and grade2 is %c\n", grade1, grade2);
}
void SwapEm (char *p_grade1, char *p_grade2)
{
char temp;
temp = *p_grade1;
*p_grade1 = *p_grade2;
*p_grade2 = temp;
}
why *p_grade1 and *p_grade2 werent officially declared within the function but were declared in parameter list, can you always declare them in parameter list??
any help would be greatly appreciated.,
thanx!!!