<p>CS 206 – C2 – Lexical Elements, Operators and the C System</p><p>Notes… Programming Languages (C,Fortran,Pascal,ADA,etc.) Syntax Compiler PreProcessor Tokens (keywords,identifiers,constants,string constants,operators,punctuators)</p><p>2.2 Comments (/* … */)</p><p>2.4 Identifiers (Variable Names…) 31 characters (alphabet,numbers,_ - Start with alp or _) Algorithmically Meaningful Names 2.5 Constants int – 35,-1,etc. float – 125.50,0.5e+10,etc. char – ‘a’,’/’,etc. (single chars in single quotes) hexadecimal – Ox2A,etc.</p><p>2.6 String Constants character string within double quotes</p><p>2.7 Operators and Punctuators arithmetic operators => + - * / % (Modulo) punctuators => parentheses,braces,commas,semicolons</p><p>2.8 Operator Precedence and Associativity</p><p>Multiplication/Division Higher Than Addition/Subtraction Expressions evaluated L=> R, except for …</p><p>2.9 Increment/Decrement Operators (On Identifiers Only) ++i or i++ Both => i = i + 1; ++i; Value of Expression (++i) is incremented value of i, i++; Value of Expression (i++) is original value of i.</p><p>2.10 Assignment Operators variable = expression; Double Operations… k += 2; Semantics: variable op= expression; Evaluates to variable = variable op (expression);</p><p>2.11 Powers of Two Program</p><p>2.12 The C System The PreProcessor #include <stdio.h> or #define pi 3.14159 or #include “filename” .h files include function prototypes, i.e., types of arguments to/from function, not function executable code. The Standard Library Executable function code.</p><p>Random Number Code 2.13 Style Readable,Documented,etc.</p><p>2.14 Common Programming Errors Punctuation, Misspelled Words,etc. </p>
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages6 Page
-
File Size-