Created
April 10, 2019 12:58
-
-
Save Warwolt/0eb5f195952f4ce85aaf65ca22ff9055 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void add_num(int num) | |
{ | |
num += 1; | |
} | |
void add_num_ptr(int* num) | |
{ | |
*num += 1; | |
} | |
int main(void) | |
{ | |
int number = 12; | |
printf("%d\n", add_num); // prints 12 | |
printf("%d\n", add_num); // prints 12 | |
printf("%d\n", add_num_ptr(&num)); // prints 13 | |
printf("%d\n", add_num_ptr(&num)); // prints 14 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment