Hey I am new to programming, and I am reading a book and it has questions and answers after every section. One of them asks:
How would the number 2321 be spanned through memory? and the answer is:
1st byte 9 and 2nd byte 17
What do they mean by this? I've looked through the section again and do not understand the question or the answer.
Also it asks:
What would be the result of the following operation:
int Result, a, b, c;
a = 9;
b = 1;
c = 2;
Result = c-- + (b++ - --b) * a + c
They have the answer as 11, but I have the answer as 21. Can someone explain to me how they have that answer and what I did wrong. Here is what I did:
first I did my post and prefix operation which make the problem like this:
result = 2 + (1 - (-1)) * 9 + 1
result = 2 + (2) * 9 + 1
result = 2 +18 + 1
result = 21
The b gets added 1 to the taken directly away again right??? since it is a negative 1 then it is added to to make a 0 and then taken from to make a negative 1 again and then 1 - negative 1 is prositive 2.
The c's are 2 and 1 which make 3 right? I'm confused.
Thanks for any help.