Created
March 16, 2024 20:31
-
-
Save gavinwhyte/71aa9ba729dce638ccf576a8b3979c96 to your computer and use it in GitHub Desktop.
c pointers
This file contains 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
#include <stdio.h> | |
void function(int param) { | |
printf("I've received value %d\n", param); | |
param++; | |
} | |
int main(void) { | |
int variable = 111; | |
function(variable); | |
printf("variable %d\m", variable); | |
return 0; | |
} | |
The result is | |
I've received value 111 | |
variable=111 | |
------------------------------------------------- | |
#include <stdio.h> | |
void function2(int *param) { | |
printf("I've received value %d\n", *param); | |
(*param)++; | |
} | |
int main(void) { | |
int variable = 111; | |
function2(&variable); | |
printf("variable %d\n", variable); | |
return 0; | |
} | |
The result is | |
I've received value 111 | |
variable=112 |
Course on Pointers
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://www.freecodecamp.org/news/the-c-programming-handbook-for-beginners/#further-learning