ok so if we have a char *hello
- ands the string is "hello"
and i do
char *ptr ;
ptr = hello;
then ptr will be pointing at 'h'
, correct?
Now i have just done an assignmnet in this and completed it using the following terms
if i wanted to move the pointer to the next chatachter i would just do ptr++
. If i wanted to use the value of the pointer for some check, i would use if(*ptr == '\0')...
When i was doing the assignmnets our teacher gave us some pre built methods, and they used stuff like
*string++ = *s++;
ok, so why would we want to do *string
(which gets a value) - and combine it with ++
i hope i make sence in explaining what is not clear. Its just i managed ot do the whole assignmnet with ptr++ to move to next element or *ptr to check its value
thanks