ok,
say x and y are pointers to mem loc 500.
what does the stmt-
y++=x++ do;
where do x and y point now?why?
apparently they point to the same loc but i dunno why?
This is a discussion on pointers within the C Programming forums, part of the General Programming Boards category; ok, say x and y are pointers to mem loc 500. what does the stmt- y++=x++ do; where do x ...
ok,
say x and y are pointers to mem loc 500.
what does the stmt-
y++=x++ do;
where do x and y point now?why?
apparently they point to the same loc but i dunno why?
Last edited by eklavya8; 01-03-2009 at 02:21 PM.
Well as posted, it doesn't seem to make any sense.
But things like
*dst++ = *src++;
is a common way of copying a block of data from src to dst, in such a way that data is copied, and the pointers advance at the same time.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
I support http://www.ukip.org/ as the first necessary step to a free Europe.
yes i thought so too,but as i mentioned the pointers dont seem to change there current location even after the statement.
Well, you can't assign to y++, so anything can happen. But if there wasn't an error, then yes x and y would both move forward.