The C Language 1/29/15. Quiz Take quiz 1 on Blackboard Over vim, linux, and Chapter 1.
-
Upload
philomena-webb -
Category
Documents
-
view
212 -
download
0
Transcript of The C Language 1/29/15. Quiz Take quiz 1 on Blackboard Over vim, linux, and Chapter 1.
![Page 1: The C Language 1/29/15. Quiz Take quiz 1 on Blackboard Over vim, linux, and Chapter 1.](https://reader035.fdocuments.in/reader035/viewer/2022072006/56649f435503460f94c63ec6/html5/thumbnails/1.jpg)
The C Language
1/29/15
![Page 2: The C Language 1/29/15. Quiz Take quiz 1 on Blackboard Over vim, linux, and Chapter 1.](https://reader035.fdocuments.in/reader035/viewer/2022072006/56649f435503460f94c63ec6/html5/thumbnails/2.jpg)
Quiz
• Take quiz 1 on Blackboard• Over vim, linux, and Chapter 1.
![Page 3: The C Language 1/29/15. Quiz Take quiz 1 on Blackboard Over vim, linux, and Chapter 1.](https://reader035.fdocuments.in/reader035/viewer/2022072006/56649f435503460f94c63ec6/html5/thumbnails/3.jpg)
Assignment
On your own, answer the following questions. – p.17 #1– p. 31 #3
Edit, compile and execute this program. – p. 57 #3– submit jjarboe cs115 2
Read pp. 65-94 and Chapter 3 for next week.
![Page 4: The C Language 1/29/15. Quiz Take quiz 1 on Blackboard Over vim, linux, and Chapter 1.](https://reader035.fdocuments.in/reader035/viewer/2022072006/56649f435503460f94c63ec6/html5/thumbnails/4.jpg)
C is a Functional Language
Example program ch2/retail.c
Existing functions serve as basis for new functions.
printf and library function used to create main
![Page 5: The C Language 1/29/15. Quiz Take quiz 1 on Blackboard Over vim, linux, and Chapter 1.](https://reader035.fdocuments.in/reader035/viewer/2022072006/56649f435503460f94c63ec6/html5/thumbnails/5.jpg)
main Function
Exactly one main() in a program Tells other functions when to execute
Calls them
int main() -- Function Header{ -- Body inside
{ } -- Executable Statements
}
![Page 6: The C Language 1/29/15. Quiz Take quiz 1 on Blackboard Over vim, linux, and Chapter 1.](https://reader035.fdocuments.in/reader035/viewer/2022072006/56649f435503460f94c63ec6/html5/thumbnails/6.jpg)
Comments
/* Comment */
Ignored by compiler Documents program
![Page 7: The C Language 1/29/15. Quiz Take quiz 1 on Blackboard Over vim, linux, and Chapter 1.](https://reader035.fdocuments.in/reader035/viewer/2022072006/56649f435503460f94c63ec6/html5/thumbnails/7.jpg)
Preprocessor Command
#include <stdio.h>
Inserts code at that point Inserts the code before the compile
Provides interface with printf and scanf functions
![Page 8: The C Language 1/29/15. Quiz Take quiz 1 on Blackboard Over vim, linux, and Chapter 1.](https://reader035.fdocuments.in/reader035/viewer/2022072006/56649f435503460f94c63ec6/html5/thumbnails/8.jpg)
printf
Sends argument to monitor screen
printf(“Hello, Steve\n”);
![Page 9: The C Language 1/29/15. Quiz Take quiz 1 on Blackboard Over vim, linux, and Chapter 1.](https://reader035.fdocuments.in/reader035/viewer/2022072006/56649f435503460f94c63ec6/html5/thumbnails/9.jpg)
Programming Style
What is wrong with style2.c? No Syntax Errors
![Page 10: The C Language 1/29/15. Quiz Take quiz 1 on Blackboard Over vim, linux, and Chapter 1.](https://reader035.fdocuments.in/reader035/viewer/2022072006/56649f435503460f94c63ec6/html5/thumbnails/10.jpg)
Programming Style
Indentation Indent statements between { }
Comments Name, Date, Description of program
Meaningful identifiers “counties” instead of “x”
![Page 11: The C Language 1/29/15. Quiz Take quiz 1 on Blackboard Over vim, linux, and Chapter 1.](https://reader035.fdocuments.in/reader035/viewer/2022072006/56649f435503460f94c63ec6/html5/thumbnails/11.jpg)
Questions
Give an example of a preprocessor
command.
What are two rules for good programming
style?
![Page 12: The C Language 1/29/15. Quiz Take quiz 1 on Blackboard Over vim, linux, and Chapter 1.](https://reader035.fdocuments.in/reader035/viewer/2022072006/56649f435503460f94c63ec6/html5/thumbnails/12.jpg)
Next
Data Types and Arithmetic Operations