/* learning pointers */ #include void swap (char *x, char *y); //swap takes 2 pointers to chars int main ( void ) { char a = 'a'; char b = 'b'; swap(&a, &b); //pass the address of both chars to swap printf("%c, %c\n", a, b); //(effectively making them the equiv of a pointer) return 0; } void swap (char *x, char *y) { char temp; temp = *x; // temp is assigned the value in which x points to *x = *y; // the value x points to is assigned to the value y points to *y = temp; // the value y points to is assigned the value of temp }