Hey,
I'm trying to figure out how pointers and C String work together I know the basics about pointer arithmetic but I am having trouble implementing it in my program. I am having a problem at the for loop.
/* Trying to print a string from an offst using pointer arithmatic */
#include<stdio.h>
int main(){
char words[100] = ("This is my hundredth attept st this extremely annoying task :)");
puts(words);
/* printing one char is no problem with printf */
printf("%c\n", *(words + 3));
/* printing with putchar is also no problem so far */
putchar(*(words + 3));
/* printing with an offset of 11 and ending 21 to print the word "hundreth" */
for(*(words + 11); !*(words + 21); *(words++)){
putchar(*words);
}
}
This is the error I get with the GCC compiler.
pointer3.c: In function ‘main’:
pointer3.c:15: error: lvalue required as increment operand
Thanks