Skip to main content
1 of 3
G B
  • 22.8k
  • 1
  • 20
  • 53

###Assign instead of return.

This is not really standard C, but works with every compiler and CPU that I know of:

int sqr(int a){return a*a;}

has the same effect as:

int sqr(int a){a*=a;}

Because the first argument is stored into the same CPU register as the return value.

###X-Macros Another useful feature: X-Macros can help you when you have a list of variables and you need to do some operation which involve all of them:

https://en.wikipedia.org/wiki/X_Macro

G B
  • 22.8k
  • 1
  • 20
  • 53