B
Bill Cunningham
I read and read my text and; well I don't know what going on here. I
have tried several things. I have to lower myself to asking what's wrong.
Maybe I'll learn something. This wouldn't even compile. All the different
things I tried gave all the same errors.
#include <stdio.h>
int main()
{
char p[3] = { "one", "two", "three" };
char *pa[3];
pa[0] = &p[2];
pa[1] = &p[1];
pa[2] = &p[0];
printf("%s %s %s\n", p[0], p[1], p[2]);
printf("%s %s %s\n", *(pa[0]), *(pa[1]), *(pa[2]));
return 0;
}
p.c: In function 'main':
p.c:5:5: error: excess elements in char array initializer
p.c:5:5: error: (near initialization for 'p')
p.c:5:5: error: excess elements in char array initializer
p.c:5:5: error: (near initialization for 'p')
p.c:5:17: warning: initializer-string for array of chars is too long
[enabled by default]
I guess the problems is on line 5.
Bill
have tried several things. I have to lower myself to asking what's wrong.
Maybe I'll learn something. This wouldn't even compile. All the different
things I tried gave all the same errors.
#include <stdio.h>
int main()
{
char p[3] = { "one", "two", "three" };
char *pa[3];
pa[0] = &p[2];
pa[1] = &p[1];
pa[2] = &p[0];
printf("%s %s %s\n", p[0], p[1], p[2]);
printf("%s %s %s\n", *(pa[0]), *(pa[1]), *(pa[2]));
return 0;
}
p.c: In function 'main':
p.c:5:5: error: excess elements in char array initializer
p.c:5:5: error: (near initialization for 'p')
p.c:5:5: error: excess elements in char array initializer
p.c:5:5: error: (near initialization for 'p')
p.c:5:17: warning: initializer-string for array of chars is too long
[enabled by default]
I guess the problems is on line 5.
Bill