C
Chad
Given the following...
#include <stdio.h>
#include <stdlib.h>
void
printme(char *s)
{
printf("%s\n", s);
}
int
main( void )
{
/*char **cmd;*/
char *cmds[] = {
"This",
"is",
"a line",
NULL
};
for( ;*cmds != NULL; cmds++ ) {
printme( *cmds);
}
return 0;
}
I get 'error: invalid lvalue in increment' when I try to complie it..
[cdalten@localhost oakland]$ gcc -g -Wall traverse.c -o traverse
traverse.c: In function ‘main’:
traverse.c:21: error: invalid lvalue in increment
[cdalten@localhost oakland]$
Why can't I just increment cmds in this case?
Chad
#include <stdio.h>
#include <stdlib.h>
void
printme(char *s)
{
printf("%s\n", s);
}
int
main( void )
{
/*char **cmd;*/
char *cmds[] = {
"This",
"is",
"a line",
NULL
};
for( ;*cmds != NULL; cmds++ ) {
printme( *cmds);
}
return 0;
}
I get 'error: invalid lvalue in increment' when I try to complie it..
[cdalten@localhost oakland]$ gcc -g -Wall traverse.c -o traverse
traverse.c: In function ‘main’:
traverse.c:21: error: invalid lvalue in increment
[cdalten@localhost oakland]$
Why can't I just increment cmds in this case?
Chad