Question: please post your answer pic.png Because it is an exam. So, I don't want any plagiarism. Thank you! Question #1: C Puzzles (40 points) Consider

please post your answer pic.png Because it is an exam. So, Iplease post your answer pic.png

Because it is an exam. So, I don't want any plagiarism. Thank you!

Question #1: C Puzzles (40 points) Consider a machine where integers are 4 bytes; floats are 4 bytes; doubles are 8 bytes and pointers are 4 bytes. What would the output be for each code segment? Provide brief explanations for your answer. Answer 4 out of 5 questions. Please clearly mark the problems you choose for grading, otherwise the first 4 questions will be graded. 3 points for a correct output, 7 points an adequate explanation union { float f; int i; } u_a, u_b; int main() { unsigned char x; for (x = 0; x = 0xFF; x++) { printf("0"); } printf("1 "); } int main() { u_a. i = 0; u_b.i = INT_MIN; printf("ex ex ", u_a.f=ru_b.f, u_a.i==u_b.i); } int main() { int il = Oxdeadbeef; int i2 = Oxffffbeef; int 13 = 0x00obeef; printf("d", (int) (float) il == il); printf("%d" (int)(float) i2 == 12); printf("%d ", (int) (float) i3 == 13); } Output: Output: Output: Explanation: Explanation: Explanation: int main() int a[4] = {31, 53, 73, 91); int i = 3; int main(void) { double d = 5.5; double *dp = &d; double **dpp = dpi (; a[3] == *(a+3)); printf("%d ", &a[3] == a+3); } printf("%d", (int) + 1 - (int)d); printf("%d", (int) (dp + 1) ((int)dp)); printf(" ", (int) (dpp + 1) - ((int)dpp)); Output: Output: Explanation: Explanation

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!