Last active
July 10, 2019 18:01
-
-
Save smalinux/f2f2cf64077855fd7d674dca4ffc012d to your computer and use it in GitHub Desktop.
C tips & tricks
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
int age = 20; | |
int major = 0; | |
major = age >= 18; // this line <<<<<<<<<<<<<<<<<<<<<<< | |
printf(”Major equals : %d\n”, major); |
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
# Simple approach | |
#include "stdio.h" | |
int X; | |
int * ptrX = &X; | |
int * manipX(); | |
int main() { | |
printf("X: %d\n", *manipX() ); | |
return 0; | |
} | |
int * manipX() { | |
int * newptr; | |
*newptr = 5; | |
return newptr; // !! 5 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment