Answer 6 4 5 2 7 1 3 note that line 4 also can go any

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: include <stdio.h> 7. puts(msg); Write out the proper arrangement (line numbers are sufficient) of this code. Answer: 6, 4, 5, 2, 7, 1, 3. Note that line 4 also can go any place before line 2, and line 2 can also go before the function starts in line 5. Also, line 6 can go anywhere before the function starts. Problem 1.5 For each of the following statements, explain why it is not correct, and fix it. (a) #include <stdio.h>; Answer: Preprocessor macros like #include should not be terminated with semicolons. The correct code is: #include <stdio.h> (b) int function(void arg1) { return arg1-1; } Answer: The void type signifies an empty variable, which cannot be used in any way. The correct code is: i n t f u n c t i o n ( i n t a r g 1 ) { r eturn a rg1 − 1; } (c) #define MESSAGE = "Happy new year!" puts(MESSAGE); Answer: The form of the #define statement does not include an assignment operator: #define MESSAGE " Happy n ew y ear !" p u t s (MESSAGE) ; 3...
View Full Document

This document was uploaded on 03/17/2014 for the course EECS 6.087 at MIT.

Ask a homework question - tutors are online