Question: 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

1 Expert Approved Answer
Step: 1 Unlock 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!