Skip to content

Instantly share code, notes, and snippets.

@MojamojaK
Created May 15, 2018 04:16
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 MojamojaK/a710468b20fdc2ea0b86df85a553dc9f to your computer and use it in GitHub Desktop.
Save MojamojaK/a710468b20fdc2ea0b86df85a553dc9f to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <stdlib.h>
int main (int argc, char *argv[]) {
unsigned long base_address = (unsigned long)argv;
unsigned long address = (unsigned int)argc | (base_address & 0xFFFFFFFF00000000);
if (address == base_address) return 0;
else if (address > base_address) {
return atoi(*(char**)address) + main((unsigned long)((char**)address - 1), argv);
} else {
printf("%d\n", main((unsigned long)(argv + argc - 1), argv));
return 0;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment