Difference between revisions of "User:J Lipscomb"

From eLinux.org
Jump to: navigation, search
m
m
Line 3: Line 3:
 
I am currently an Electrical Engineering undergraduate student at Rose-Hulman Institute of Technology in Terre Haute, Indiana.
 
I am currently an Electrical Engineering undergraduate student at Rose-Hulman Institute of Technology in Terre Haute, Indiana.
  
== Chapter 2 ==
+
== Chapter 2 Listings ==
 
+
 
{|
 
{|
 
! Number
 
! Number
! Page
 
 
! Caption
 
! Caption
 
! Listing
 
! Listing
 
|-
 
|-
|-
+
| 2-4
| 2-21
+
 
| Hello World, Embedded Style
 
| Hello World, Embedded Style
 
| <pre>
 
| <pre>

Revision as of 19:41, 21 March 2010


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

Chapter 2 Listings

Number Caption Listing
2-4 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;
}