Question

0.2/0.2 pts Question 2 Read the program and the descriptions below #include <stdio.h> int x=0x10, y=0x200, z=0x30; int main)Can someone explain how the answer is 2. thanks

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Since x,y and z are the global variables these are stored in the Data Segment of the Ram compared to the local variables which are stored in the heap.Since the execution of the code is generally from the LHS to the RHS.

Creation of z happens after x and y.Therefore if we are referring z variable memory manager has to jump 2 steps to access z.Therefore the offset associated with the z variable will be 2.

Add a comment
Know the answer?
Add Answer to:
Can someone explain how the answer is 2. thanks 0.2/0.2 pts Question 2 Read the program and the descriptions below #include <stdio.h> int x=0x10, y=0x200, z=0x30; int main) int a, b-0x12, c-0x20...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 1. (1, a, b, c) please answer and explain all abc using information below: 1. a,...

    1. (1, a, b, c) please answer and explain all abc using information below: 1. a, b, c Read the program and the descriptions below before answering the next 6 questions. #include <stdio.h> int w = -1, x = 3, y = -5, z = 7; int main() { = 4, b = 3, c = 2, d = 1; while (b >= -2) { b = b + W; y = z - d; int a } printf("b =...

  • lab3RGB.c file: #include <stdio.h> #define AlphaValue 100 int main() { int r, g,b; unsigned int rgb_pack...

    lab3RGB.c file: #include <stdio.h> #define AlphaValue 100 int main() { int r, g,b; unsigned int rgb_pack; int r_unpack, g_unpack,b_unpack; int alpha = AlphaValue; printf("enter R value (0~255): "); scanf("%d",&r); printf("enter G value (0~255): "); scanf("%d",&g); printf("enter B value (0~255): "); scanf("%d",&b); while(! (r<0 || g<0 || b <0) ) { printf("A: %d\t", alpha); printBinary(alpha); printf("\n"); printf("R: %d\t", r); printBinary(r); printf("\n"); printf("G: %d\t", g); printBinary(g); printf("\n"); printf("B: %d\t", b); printBinary(b); printf("\n"); /* do the packing */ //printf("\nPacked: value %d\t", rgb_pack); printBinary(rgb_pack);printf("\n");...

  • Code in C++. Can someone make it so that the code below can be compiled? ▪...

    Code in C++. Can someone make it so that the code below can be compiled? ▪ Creating an empty queue ▪ Inserting a value ▪ Removing a value ▪ Finding the size of the queue ▪ Printing the contents of the queue ▪ Adding the contents of one queue to the end of another ▪ Merging the contents of two queues into a third, new, queue Class Attributes Your class should be implemented using a linked list and should have...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT