increment casted void pointer -- ANSI?
Stephen R. van den Berg
berg at marvin.e17.physik.tu-muenchen.de
Sat Mar 9 01:22:38 AEST 1991
Suppose I have the following (silly example, I know :-) program:
#include <stdio.h>
main(){static char s[]="abcd";void*p;int a,b;
p=s;
a=*(char*)p;
b=*++(char*)p;
*--(char*)p=b;
*++(char*)p=a;
puts(s);
return 0;}
Now, you tell me if this is ANSI or K&R or neither, and if it's not ANSI,
how do I do it in ANSI then?
I always thought this was ANSI code, but there seems to be some
compiler on an IBM RT that says otherwise.
Thanks.
--
Sincerely, berg at marvin.e17.physik.tu-muenchen.de
Stephen R. van den Berg.
"I code it in 5 min, optimize it in 90 min, because it's so well optimized:
it runs in only 5 min. Actually, most of the time I optimize programs."
More information about the Comp.lang.c
mailing list