[chbot] C Challange #6
    Andre Renaud 
    andre at bluewatersys.com
       
    Thu Sep 22 22:12:27 BST 2011
    
    
  
Unfortunately, as I don't tend to attend the local meetings I won't be
able to back this up with a Chocolate Fish. However, who can give the
correct output for the following C program, with an explanation for why.
#include <stdio.h>
#include <string.h>
#define xmod(s) mod(s)
#define mod(s) #s
#define foo 20
int main(int argc, char *argv[])
{
  char buffer[20], buffer2[20];
  strcpy(buffer, mod(foo));
  strcpy(buffer2, xmod(foo));
  printf("%s %s\n", buffer, buffer2);
  return 0;
}
Regards,
Andre
    
    
More information about the Chchrobotics
mailing list