course-c

Introduction

Variable Names

Keywords

           
auto default for return switch while
break double goto short typedef  
case else if signed union  
char enum int sizeof unsigned  
const extern long static void  
continue float register struct volatile  

Basic Data Types

Integer types

  bits unsigned signed
long 32 0 to 2^32 - 1 -2^31 to 2^31 - 1
int 32 0 to 2^32 - 1 -2^31 to 2^31 - 1
short 16 0 to 2^16 - 1 -2^15 to 2^15 - 1
char 8 0 to 2^8 - 1 -2^7 to 2^7 - 1

Floating point types

  Range Precision
float 1E-37 to 1E+37 6
double 1E-308 to 1E+308 15
long double 1E-308 to 1E+308 15

Constants

Numeric constants

Character constants

String constants

Escape sequences

Constant expression

Enumeration constants

Variable Declarations

Arithmetic Operators

Relational operators

Logic operators

Bitwise operators

Assignment operators

Expressions

Side effects

Operator Precedence

:::: {.columns}

::: {.column width=”40%”}

   
() [] -> . left to right
! ~ ++ -- + - * & right to left
(type) sizeof  
* / % left to right
+ - left to right
<< >> left to right
< <= > >= left to right
== != left to right
& left to right

:::

::: {.column width=”60%”}

     
^ left to right  
| left to right  
&& left to right  
|| left to right  
?: right to left  
= += -= *= /= %= right to left  
` &= ^= = «= »=`  
, left to right  

:::

::::

Conditional expressions

Automatic type conversion

Automatic type conversion rules

:::: {.columns}

::: {.column width=”50%”}

For an operator that takes two operands

:::

::: {.column width=”50%”}

:::

::::

Type casting