Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

using namespace std; int main ( ) { struct foo _ t { int x [ 1 0 0 ] ; int var 1 ;

using namespace std;
int main(){
struct foo_t {
int x[100];
int var1;
int y[10];
} foo;
int var2;
long i;
int *p,*q;
short int *s;
long int *l;
struct foo_t bar[50];
for (i=0; i<100; i++) foo.x[i]=300+i;
for (i=0; i<10; i++) foo.y[i]=800+i;
foo.var1=440;
cout << sizeof(*s)<<"
";
cout << sizeof(*p)<<"
";
cout << sizeof(*l)<<"
";
q =(int *) &foo; cout << q <<"
";
p=&(foo.x[5]); cout <<*p <<"
";
// POINT 1
q =(int *) &var2; cout << q <<"
";
q = p+16; cout <<*q <<"
";
i =((long) p)+16;
q =(int *) i; cout <<*q <<"
";
s =(short *) i; cout <<*s <<"
";
l =(long *) i; cout <<*l <<"
";
q = p+95; cout <<*q <<"
";
i =((long) p)+17;
q =(int *) i; cout <<*q <<"
"; // EXPLAIN
q = p +_______; cout <<*q <<"
";
q =(int *)(((long) p)+_______); cout <<*q <<"
";
p =(int *) bar;
*(p +_______)=947; cout << bar[8].var1<<"
";
}Based on your output, make a diagram indicating the addresses in memory where each of the programs variables are store#include
d and their values at POINT 1.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Filing And Computer Database Projects

Authors: Jeffrey Stewart

2nd Edition

007822781X, 9780078227813

More Books

Students also viewed these Databases questions