Beginner's question concerning pointers and arrays
I am having trouble understanding why I can't get my array of strings to print using a pointer.
Here is my code so far:
Code:
#include <stdio.h>
int main() {
int a[] = {1, 10, 100, 1000};
int *b = a;
char *c[] = {"hello", "how", "are", "you?"};
printf("%d\n", *b);
printf("%d\n", *++b);
printf("%d\n", *++b);
printf("%s\n", *c);
printf("%s\n", *++c);
return 0;
}
When I run try to compile this code, I receive this error:
Code:
pointer-test.c: In function ‘main’:
pointer-test.c:14: error: lvalue required as increment operand
Why does the same pointer syntax not work for an int array and a string array?
Thanks for any help.