CS 206 C2 Lexical Elements, Operators and the C System

CS 206 C2 Lexical Elements, Operators and the C System

<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>

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    6 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us