Created
September 15, 2008 22:25
-
-
Save jeremyBanks/10957 to your computer and use it in GitHub Desktop.
[2010-01] me being thrilled upon discovering alloca
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//&>/dev/null;x="${0%.*}";[ ! "$x" -ot "$0" ]||(rm -f "$x";cc -o "$x" "$0")&&"$x" $*;exit | |
// http://stackoverflow.com/questions/31937/what-is-your-favourite-non-standard-c-library-function#32064 | |
#include <stdio.h> | |
#include <alloca.h> | |
int main(int argc, char* argv[]) { | |
char* myString = alloca(sizeof(char) * 5); | |
myString[0] = 'H'; | |
myString[1] = 'e'; | |
myString[2] = 'y'; | |
myString[3] = '.'; | |
myString[4] = 0; | |
printf("%s", myString); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment