Function overloading in C ยท GitHub

Skip to content </textarea> '"` All gists GitHub Sign up for a GitHub account Sign in barosl / add.c /.container /.repohead Code Revisions 1 Stars 93 Forks 6 Embed HTTPS Subversion You can clone with </textarea> '"` HTTPS or </textarea> '"` Subversion . Download ZIP /.repository-sidebar Function overloading in C Raw add.c # include < stdio.h > # include < stdlib.h > # include < string.h > int addi ( int a, int b) { return a + b; } char * adds ( char *a, char *b) { char *res = malloc ( strlen (a) + strlen (b) + 1 ); strcpy (res, a); strcat (res, b); return res; } # define add ( a, b ) _Generic(a, int : addi, char *: adds)(a, b) int main ( void ) { int a = 1 , b = 2 ;...

Linked on 2015-07-27 07:18:03 | Similar Links