Question: Overview: Write a C program that utilizes two functions, a main function and a called function. Create a pictorial of the argument build area for

 Overview: Write a C program that utilizes two functions, a "main"

Overview: Write a C program that utilizes two functions, a "main" function and a called" function. Create a pictorial of the "argument build area" for the "main" function that depicts what is pushed onto the "top of stack" (and where) for the call to the "called" function based on one of your program executions. Remember, the stack location will be different each time you run your program. The "main" function should initialize a struct that represents some simple student information. i.e. Student's ID(int), Last Name, First Name, Birth Month, Day and Year(arrays of char) and prints it out. The "main" function will call the "called" function and pass the struct as an argument. . print the base pointer information for the main function. o Example: void *baseptr; asm("movl %%ebp, %0;" :"-r" (baseptr) )/*Takes contents of %ebp and stores in baseptr */ printf("The value of basepointer main:|n"); printf("%p ",baseptr); The "called" function will also contain in-line assembler code to obtain and print the base pointer information for itself. The "called" function should also print the value stored at its base memory location. This should be the "main" function's "base memory address" The "called" function should print the addresses of each of the struct's elements to obtain where they reside in memory . The combination of the Birth Month and Birth Day is a total of 4 bytes. In the "called" function retrieve these 4 bytes as an integer and print the result

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To solve this problem lets break down the requirements into steps and then provide a sample C program that fulfills them Step 1 Define the Struct We w... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!