Skip to content

Instantly share code, notes, and snippets.

@sbz
Created July 13, 2011 13:11
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 sbz/1080266 to your computer and use it in GitHub Desktop.
Save sbz/1080266 to your computer and use it in GitHub Desktop.
test how system stack is growing
#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