Skip to content

Instantly share code, notes, and snippets.

@lasarus
Created August 29, 2012 19:52
Show Gist options
  • Save lasarus/3517950 to your computer and use it in GitHub Desktop.
Save lasarus/3517950 to your computer and use it in GitHub Desktop.
Adding numbers in C without "+"
#include <stdio.h>
/* DISCLAIMER: THIS IS NOT MEANT TO BE USED IN REAL PROGRAMS */
int main(int argc, char ** argv)
{
void * a = (void *)10;
void * b = (void *)5;
void * r;
r = &(((char *)a)[(size_t)b]);
printf("%i\n", (size_t)r);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment