Skip to content

Instantly share code, notes, and snippets.

@smalinux
Last active July 10, 2019 18:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smalinux/f2f2cf64077855fd7d674dca4ffc012d to your computer and use it in GitHub Desktop.
Save smalinux/f2f2cf64077855fd7d674dca4ffc012d to your computer and use it in GitHub Desktop.
C tips & tricks
int age = 20;
int major = 0;
major = age >= 18; // this line <<<<<<<<<<<<<<<<<<<<<<<
printf(”Major equals : %d\n”, major);
# 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