#Meta-Wlp: #Macro: TITLE wlp: Learn C (5) p. 7 #Eval: $TITLE$ #Macro: PAGE bb5-7

Danny Thomas was a famous actor, played in Father Knows Best.

#include<stdio.h>

void swapNames( struct name n1, struct name n2 ) {
   char * temp ;
   temp = n1.first ;
   n1.first = n2.last ;
   n2.last = temp ;
}

int main(int argc, char * argv) {
  struct name { 
    char * first ; 
    char * last ; } ;

  struct name n1 = { "dylan", "thomas" } ;
  struct name n2 = { "bob", "danny" } ;

  swapNames( n1, n2 ) ;

  printf("%s %s\n", n1.first, n1.last ) ;
  printf("%s %s\n", n2.first, n2.last ) ;

}
Does this work? #Shuffle: none $PAGE$-A $PAGE$-B Return to Learn C Introduction #: Yes, everything seems to work for you. Nothing ever works for me. #: No, this is a rhetorical question, and it wonldn't be adaquating leading if it worked. #: