Z
zmbdcqnrdfetnws
Hello,
I have a question; Can someone explain this beginning
programmer why the following pointer `ptr' assigment
to the array of pointers to strings `*palpha[]' won't work ?
#include <stdio.h>
#include <ctype.h>
int main(void) {
const char *palpha[]= { "alpha", "bravo", "charlie", "delta" };
char *ptr = NULL;
int i = 0;
for(i = 0; i < 4; i++) {
/* this doesn't seem to work ? */
ptr = palpha;
while(*ptr++)
printf("%c", toupper(*ptr));
printf("\n");
}
return 0;
}
If anyone could explain the reasoning behind my faillure
I would be greatfull....
Thnkx..
J.
I have a question; Can someone explain this beginning
programmer why the following pointer `ptr' assigment
to the array of pointers to strings `*palpha[]' won't work ?
#include <stdio.h>
#include <ctype.h>
int main(void) {
const char *palpha[]= { "alpha", "bravo", "charlie", "delta" };
char *ptr = NULL;
int i = 0;
for(i = 0; i < 4; i++) {
/* this doesn't seem to work ? */
ptr = palpha;
while(*ptr++)
printf("%c", toupper(*ptr));
printf("\n");
}
return 0;
}
If anyone could explain the reasoning behind my faillure
I would be greatfull....
Thnkx..
J.