QUESTION 1.

In the following code a peice of info is printed at each PR can people help me give me what is gona be printed. thanks.

Code:
```#include "defs.h2

int a[] = {0,1,2,3,4};

void main(void)
{
int i, *p;

for(i = 0;i <= 4; i++) PR(d, a[i]);
NL;
for(p = &a[0]; p <= &a[4]; p++) PR(d, p[i]);
NL;
for(p = a;, i = 0; p + i <= a + 4; p++, i++)
PR(d, *(p + i));
NL;
for (p = a + 4; p >= a; p--) PR(d, *p);
NL;
for(p = a + 4, i = 0; i <= 4; i++) PR(d, p[-i]);
NL;
for(p = a +4; p >= a; p--) PR(d, a[p - a]);
NL;
}```
QUESTION 2
Can any provide me with the print out valuers for the followong 4 printf statments??
Code:
```void main(void)
{
int x;

x = - 3 + 4 * 5 - 6;
printf("%d\n", x);

x = 3 + 4 % 5 - 6;
printf("%d\n", x);

x = - 3 * 4 % - 6 / 5;
printf("%X\n", x);

x = (7 + 6) % 5 / 2;
printf("%X\n", x);
}```

P.S. Thanks Amill for everyone's help this is study for my exam in januruary,

thanks.

2. How about you compile it and run it? And turn the warnings up so it'll catch the garbage you have (like having main() declared as returning void).

3. Originally Posted by tipp2007
QUESTION 1.

In the following code a peice of info is printed at each PR can people help me give me what is gona be printed. thanks.
Given the fact that you haven't shown any code related to those PR functions/macros/whatevers, it will be difficult for me to divine an answer as to what output they'll produce. I'll have to resort to other methods... magic 8-Ball says "Ask again later."

4. Sound by the way there is answers and outputs, but obivously your to my much of a smart azzz to know them, thanks for nothing!!!!

5. Originally Posted by tipp2007
Sound by the way there is answers and outputs, but obivously your to my much of a smart azzz to know them, thanks for nothing!!!!
You didn't provide enough information to find out what the output is, and then you complain because you don't understand what we say. If this is your attitude, I have something to tell you:

Go write your exam in January and we'll see who the smart guy is.

6. Actually, there won't be any output. Why? Well, you're missing a " in the #include, for one. void main() is also non-standard, and int main() should be used instead, but if that's what the question said then you can't really do much about it I suppose. Put your instructor online so we can yell at him/her.

Question 2 looks a little more complete, so . . . it's actually quite simple to solve. You need to know only a few things:
• What the &#37;X format specifier does.
• The operator precedence of arithmetic operators.

%X prints a hexadecimal number, with the letters in uppercase, as you can easily determine from documentation. http://www.cppreference.com/stdio/printf.html

Just like in math, * and / are evaluated before (have higher precedence than) + and -, and the unary negation (minus sign) has a higher precedence still, so an expression like "- 3 + 4 * 5 - 6" becomes "(-3) + (4 * 5) - 6". You can figure that out, right?

7. Getting answers from us wont really help if you dont try to find solutions yourself.
Try them out first and then post the problems you face.

8. Well it may well be compiler dependent, but assuming usage of VS2005, the correct answer to the first one is that it will output this:
Code:
`error C2001: newline in constant`
Gotta love trick questions huh!