hi,
i have a string like this:
char *original="helloworld":
char *str;
str=&original[0];
while(*str!='0')
{
printf("%c", *str);
str++;
}
it prints helloworld
what i am trying to do is to say: only loop the first 3 chars...One way is to use a count in the loop which
i understand..i am learning pointer arithmetic , so, i am trying pointer arithmetic way like this but it is not doing what i am trying which is : if you move 3 steps arithmetically ..thanks
while(*str!='0'&&str < 3)
{
printf("%c", *str);
str++;
}
Start Free Trial