Created
July 13, 2011 13:11
-
-
Save sbz/1080266 to your computer and use it in GitHub Desktop.
test how system stack is growing
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
#include <stdio.h> | |
#include <sys/utsname.h> | |
inline static void | |
u() { | |
struct utsname uts; | |
uname(&uts); | |
printf("%s %s %s %s %s", uts.sysname, uts.nodename, uts.release, uts.version, uts.machine); | |
} | |
void | |
test_stack_growing(int *first) { | |
int second; | |
int third; | |
printf("first %p, second %p, third %p\n\n", first, &second, &third); | |
printf("stack is growing %s sbz on ", (&second > first) ? "up" : "down"); | |
u(); | |
puts("\n"); | |
} | |
int | |
main(void) { | |
int first; | |
test_stack_growing(&first); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment