Answer to Question #52559 in C for Sujata Roy

Question #52559
what is the value of x?

x = 6 ["computer"] ;
1
Expert's answer
2015-05-15T03:24:53-0400
Solution.
Expressions6 ["computer"] is defined exactly as *((6) + ("computer")).
“computer”equivalent to pointer on constant array of chars
Constchar* someconststring ={‘c’,’o’,’m’,’p’,’u’,’t’,’e’,’r’,’\0’}
6constant integer Const Int someint=6;
So(6) + ("computer") equivalent to ( someconststring)+(6) as the
constant array of chars is located in memory continuously expressions pointed to 6 element of {‘c’,’o’,’m’,’p’,’u’,’t’,’e’,’r’,’\0’}
Indirection of this address equal to‘e’.
Answer:
x=’e’;

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS