// intialize a char variable, print its address and the next address char charvar = '\0'; printf("address of charvar = %p\n", (void *) (&charvar)); printf("address of charvar - 1 = %p\n", (void...





Assembly language



Part 1: When a variable is stored in memory, it is associated with an address. To obtain the address of a variable, the & operator can be used.  Write a C program addressOfScalar.c by inserting the code below in the main function. Questions:




1) Run the C program, attach a screenshot of the output in the answer sheet.


2) Attach the source code in the answer sheet


3) Then explain why the address after intvar is incremented by 4 bytes instead of 1 byte.


// intialize a char variable, print its address and the next address<br>char charvar = '\0';<br>printf(

Extracted text: // intialize a char variable, print its address and the next address char charvar = '\0'; printf("address of charvar = %p\n", (void *) (&charvar)); printf("address of charvar - 1 = %p\n", (void *)(&charvar - 1)); printf("address of charvar + 1 = %p\n", (void *)(&charvar + 1)); 4 7 // intialize an int variable, print its address and the next address 8 int intvar = 1; printf("address of intvar = printf("address of intvar - 1 = %p\n", (void *) (&intvar - 1)); printf("address of intvar + 1 = %p\n", (void *)(&intvar + 1)); 9 %p\n", (void *)(&intvar)); 10 11 12 123

Jun 09, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here