Character Array X initialized to {a, b, c, d, e, f. g, h, I, j, k, I, m, A.B, C,
ID: 3806663 • Letter: C
Question
Character Array X initialized to {a, b, c, d, e, f. g, h, I, j, k, I, m, A.B, C, D, E, F, G, H, I, J, K, L, M}; Pointer Xptr refers to the first element of X array and has a value 124FFBC. Each element is represented by 16 bit uni-code. Memory is byte organized. What are the address locations of elements: c, f, and m in the above? Specify in the hex decimal notation a) Hex Addresses of elements: c _______ f __________ m b) Using Array X of part (a) above, what are the Hex Address of C, F, and M .b)Hex Addresses of elements: C_______F__________M _______ c) Functional memory initialization C program for initializing memory is as shown. All variables properly declared. for (k=20; kExplanation / Answer
C) Program:
#include <stdio.h>
int main(void) {
int k,memory[k];
for(k=20;k<30;++k)
{
memory[k]=((10*(k-2)+20));
printf("k value = %d ",k);
printf("memory[k] = %d ",memory[k]);
}
return 0;
}
Output:
k value = 20
memory[k] = 200
k value = 21
memory[k] = 210
k value = 22
memory[k] = 220
k value = 23
memory[k] = 230
k value = 24
memory[k] = 240
k value = 25
memory[k] = 250
k value = 26
memory[k] = 260
k value = 27
memory[k] = 270
k value = 28
memory[k] = 280
k value = 29
memory[k] = 290
How many total memory locations are initialized in the above loop?
Answer: 10 memory locations
d) what is the final value of variable k,after completing the for loop?
Answer: k=29
e) What are the contents of locations 18,22,24,26,28?
Answer:
memory[18] = null
memory[22] = 220
memory[24] = 240
memory[26] = 260
memory[28] = 280