Skip to content

Instantly share code, notes, and snippets.

@lynxerzhang
Created April 24, 2012 14:07
Show Gist options
  • Save lynxerzhang/2479967 to your computer and use it in GitHub Desktop.
Save lynxerzhang/2479967 to your computer and use it in GitHub Desktop.
c point study -- (exchange two variable value)
/**
* The c point study notes
* below is a exchange two specified variable value case
*/
//this function is do not return any value
//the two parameter is a pointer variable of type int
void exchangeNum(int *num1, int *num2){
int t = *num1;
*num1 = *num2;
*num2 = t;
}
int a = 2; //define a 32-bit int variable
int b = 3; //define a 32-bit int variable
exchangeNum(&a, &b); //the symbol "&" is mean get that int variable's memory location
printf("%i %i", a, b); //we found a, b value is change
@harryxu
Copy link

harryxu commented Apr 24, 2012

learning...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment