L
loudking
Hello all, please take a look at following code:
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char*argv[])
{
const char *c;
char *str= "const";
for(c=str; *c ; c++) {
printf("c=%c\n", *c);
}
return 0;
}
In this program, c is not const because in the for loop, c is
increamenting; *c is not const either because the output shows *c
equals different characters.
Then could anybody please tell me which part of variable c is
consistent anyway?
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char*argv[])
{
const char *c;
char *str= "const";
for(c=str; *c ; c++) {
printf("c=%c\n", *c);
}
return 0;
}
In this program, c is not const because in the for loop, c is
increamenting; *c is not const either because the output shows *c
equals different characters.
Then could anybody please tell me which part of variable c is
consistent anyway?