Hi I was messing around with pointer in my program and ran into a problem. The compiler was giving me an initialization error for:
Code:
void swap(char *a[10], char *b[10])
{
char *temp[10] = *b;
*b = *a;
//*a = *temp;
printf("\n\n\n--->%s\n\n\n\n",*b );
}
But when changed to:
Code:
void swap(char *a[10], char *b[10])
{
char *temp[10];
*temp = *b;
*b = *a;
//*a = *temp;
printf("\n\n\n--->%s\n\n\n\n",*b );
}
It works fine. Why can't I initialize this pointer on the same line I declare it? There must be a way.