Submitted by linuxawy on Sun, 19/10/2008 - 12:57.
The Presentation file of the first session can be downloaded from here
The Following is the presentation topics, an explanation is to be written for every line as possible...
C as a Programming Language:
- Programming as logic
- Language as grammar and syntax
- Procedural
- Modular
- Abstraction/Hiding
- C enables it, C++ supports it
- Object-Oriented
- C enables it, C++ supports it
- C++: Parametrization or Generic Programming
Building:
- Generating an executable from code
- Concept of Makefile
- Compiling -- gcc
- Linking -- ld
- Installation -- install
- Packaging -- package-manager/strip
- Uninstallation
- Cleaning
Compiling:
- Preprocessing – cpp
- Compiling – gcc
- Some important flags (-o, -c, -Wall, -L, -I, -l, -g, -O, -D, -Wl,)
- Cross compiling
Directives and Include:
- #include
- #define
- #ifdef
- Include guards
- What's in the include?
- Include path “”,
<>
General Guidelines
- Maintainability/Readability
- Deterministic modules – no voodoo
- Minimize ripple effect
- Documentation
- Intuitive naming
- Flexibility/Scalability – Growth and Reduction
- Usability
- Reusability of Code
Empty Program
- Every statement ends with ;
- Space insensitive
- {} scopes
- A brief intro to functions
- main
Data Types
- Primitive/Built-in data type controls:
- Storage
- Operation compatibility
- Typical types:
- double, float
- int, short, long, long long
- unsigned, unsigned short, unsigned long, unsigned long long
- char, unsigned char – ASCII
- typedef (architecture example)
Variables
- Data Type (Domain)
- Scope – Variables on stack
- Declaration
- int x; char c = 'k';
- int x, y;
- Global variables
- Qualifiers
- static
- extern
Data Represenation
- Writing constants
- Hex 0xa3, Octal 0666, Binary 0111b
- Chars
-
'<c>', ascii value
-
- printf
-
printf (“Printing %<sp1> %<sp2> %<sp3>\n”, var1, var2, var3);
- Type specifiers:
- %x, %u, %i, %d, %f, %lu, %lx, %Lu, %Lx, %c, %s
-
- scanf
-
scanf (“<sp1> <sp2> <sp3>”, &var1, &var2, &var3);
-
%[*][width][modifiers]type
-
Operators
- Primary (( ), , ., ->)
- Unary (pre/post++, !, ~, &, *)
- Arithmetic (*,/,%,+,-)
- Bitwise (>>,<<,&,^,|)
- Relational (<,>,<=,>=,==,!=)
- Logical (&&, ||)
- Conditional (? :)
- Assignment (=,+=,-=,*=,/=,<<=,>>=, %=,|=,&=,^=)
Precedence
Who gets processed First?
- Primary
- Unary (Right associative)
- *,/,%
- +,-
- >>,<<
- >,<,<=,>=
- ==,!=
- &
- ^
- |
- &&
- ||
- ?: (Right associative)
- Assignment (Right associative)
Casting
- Explicit cast
- char x = 'a'; int y = (int) x;
- int x = 5; char y = (char) x;
- Implicit cast
- double a, b, c; int x; c = a*b + x;
- x = a*b + c;
- Signedness
Code Example
- Printer-friendly version
- Login or register to post comments
- 89 reads

