The C Language 1/31/14
Quiz Take quiz 1 on Blackboard Over vim, linux, and Chapter 1.
Assignment On your own, answer the following questions. p.17 #1 Edit, compile and execute this program. p. 57 #3 submit jjarboe cs115 2 Read pp. 65-94 and Chapter 3 for next week.
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
main Function Exactly one main() in a program Tells other functions when to execute Calls them int main() -- Function Header { -- Body inside { } -- Executable Statements }
Comments /* Comment */ Ignored by compiler Documents program
Preprocessor Command #include <stdio.h> Inserts code at that point Inserts the code before the compile Provides interface with printf and scanf functions
printf Sends argument to monitor screen printf(“Hello, Steve\n”);
Programming Style What is wrong with style2.c? No Syntax Errors
Programming Style Indentation Comments Meaningful identifiers Indent statements between { } Comments Name, Date, Description of program Meaningful identifiers “counties” instead of “x”
Questions Give an example of a preprocessor command. What are two rules for good programming style?
Next Data Types and Arithmetic Operations