edited by
298 views
0 votes
0 votes

Consider the following C program?

The output of above program, when ‘short int take ‘2 B’ and character take 1 B to represent _________. (Assume memory storage follows Little Endian architecture).

edited by

1 Answer

1 votes
1 votes

Answer is -108.

array c = 400 401 402 403 404

now array integer takes 2 Bytes each. Let starting address is 200, then array elements addresses are = 200 202 204 206 208.

Now char pointer b points to array c. after 8 increments it will reach upto 208 (char increments by 1)

Hence at address 208 => 404 is present.

404 = > 110010100 (Bcz pointer is character)

In computer number is present in 2's compliment. hence 2's compliment value = -108.

Related questions

0 votes
0 votes
1 answer
1
srestha asked Jan 27, 2019
269 views
void foo(int n) { if(n==1) printf("#"); for(i=0;i<n;i++) foo(n-1); }Number of time # will be printed , when foo(7) is called_________