User:J Lipscomb

Revision as of 11:39, 21 March 2010 by J Lipscomb (Talk | contribs)

Jump to: navigation, search

I am currently an Electrical Engineering undergraduate student at Rose-Hulman Institute of Technology in Terre Haute, Indiana.

Chapter 2

Number Page Caption Listing
2-21 Hello World, Embedded Style
#include <stdio.h>

int bss_var;        /* Uninitialized global variable */

int data_var = 1;   /* Initialized global variable */

int main(int argc, char **argv)
  void *stack_var;            /* Local variable on the stack */
  stack_var = (void *)main;   /* Don't let the compiler */
                              /* optimize it out */

  printf("Hello, World! Main is executing at %p\n", stack_var);
  printf("This address (%p) is in our stack frame\n", &stack_var);

  /* bss section contains uninitialized data */
  printf("This address (%p) is in our bss section\n", &bss_var);

  /* data section contains initializated data */
  printf("This address (%p) is in our data section\n", &data_var);

  return 0;