Skip to content

Instantly share code, notes, and snippets.

@shichao-an
Created May 25, 2016 05:35
Show Gist options
  • Save shichao-an/962dc6f27da887a03efebced1f77f487 to your computer and use it in GitHub Desktop.
Save shichao-an/962dc6f27da887a03efebced1f77f487 to your computer and use it in GitHub Desktop.
typeof
#include <stdio.h>
#include <stdlib.h>
#define test(x) ({ \
typeof(x) _x = (x); \
_x += 1; \
_x; \
})
int main(int argc, char* argv[])
{
float f = 0.5F;
float f2 = test(f);
printf("%f\n", f2);
return EXIT_SUCCESS;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment