How to increment array of pointers to strings
I am trying to increment the pointer of this array, similar to
printf("%s\n", *argv); /* now prints the arg at argv; */
args = "x";
args = "y";
args = "z";
/* if i use:
i get error:
xxx.c:18: error: wrong type argument to increment
how can i increment the pointer and print the contents of the current
location of it?
- Re: pointer and 2d array
... elements have the same type as pointed at by the pointer. ... Since the array ahas only 3 elements, you can only increment p ... the element type of 'a' is int, not int, so it doesn't qualify. ...
- Re: decrement past beginning is valid?
... >> I know that incrementing a pointer one past the end of the array is ... It's just a pointer and you can pretty much increment and decrement ...
- Re: [C]Understanding arrays/pointers
... > Why can't I increment the value of array if it is a pointer? ... If the array is on the heap then yes it is a pointer. ...
- Re: How to increment array of pointers to strings
... barncat writes: ... how can i increment the pointer and print the contents of the current ... Your args is actually an array, ... the same effect you need a pointer to the first element of it and then ...
- Re: Excercise 5-9 (K&R II)
... pointer under these circumstances advances down pointer to the next ... but it's not legal to dereference it or increment it further. ... To get to the second row of the array, ... dimensional array. ...