fork download
  1. #include <stdio.h>
  2.  
  3. void report(char* eaf, char* initials, char* foo)
  4. {
  5. printf("eaf = %p, initials = %p, foo = %p\n", eaf, initials, foo);;
  6. printf("*eaf = %d, *initials = %d, *foo = %d\n", eaf[0], initials[0], foo[0]);
  7. }
  8.  
  9. void load(char eaf[], char initials[], char foo[])
  10. {
  11. printf("load\n");
  12. report(eaf, initials, foo);
  13.  
  14. printf("Enter EAF\n");
  15. scanf(" %s", eaf);
  16. report(eaf, initials, foo);
  17.  
  18. printf("Enter initial state\n");
  19. scanf(" %s", initials);
  20. report(eaf, initials, foo);
  21. }
  22.  
  23. int main(int argc, const char* argv[])
  24. {
  25. char eaf[10], initials[1], foo[10];
  26. report(eaf, initials, foo);
  27. load(eaf, initials, foo);
  28. report(eaf, initials, foo);
  29.  
  30. return 0;
  31. }
  32.  
Success #stdin #stdout 0s 1792KB
stdin
confused
i
stdout
eaf = 0xbfb6bd6c, initials = 0xbfb6bd6b, foo = 0xbfb6bd76
*eaf = -117, *initials = -65, *foo = -74
load
eaf = 0xbfb6bd6c, initials = 0xbfb6bd6b, foo = 0xbfb6bd76
*eaf = -117, *initials = -65, *foo = -74
Enter EAF
eaf = 0xbfb6bd6c, initials = 0xbfb6bd6b, foo = 0xbfb6bd76
*eaf = 99, *initials = -65, *foo = -74
Enter initial state
eaf = 0xbfb6bd6c, initials = 0xbfb6bd6b, foo = 0xbfb6bd76
*eaf = 0, *initials = 105, *foo = -74
eaf = 0xbfb6bd6c, initials = 0xbfb6bd6b, foo = 0xbfb6bd76
*eaf = 0, *initials = 105, *foo = -74