Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

What does this program print?

Name: Anonymous 2011-10-18 14:55


#include <stdio.h>
int main() {
  int x[5];
  printf("%p\n", x);
  printf("%p\n", x+1);
  printf("%p\n", &x);
  printf("%p\n", &x+1);
  return 0;
}


Since none of you use C compilers I know there will be no risk of cheating.

Name: Anonymous 2011-10-19 20:12

>>23
There's a more-specific answer which is also correct if you feel like going for it. There's little point though because you can easily tell from the program output people have posted.

>>24
The exact values are platform specific, but it's going to be the same on current 64bit platforms (and 32bit as well) in common use. If you can tell me a compiler that does something differently on amd64 arch I'd love to hear about it. I'll tell you now that any compiler that doesn't agree with >>13 is in violation of the spec.

(The part you probably think is implementation defined isn't, and it's a thing I wish was marked as incorrect in the spec.)

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List