































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
• C-Language Basics • Standard Input/Output • Built-in Data Types • Variables and Variable Scope • Operators • Branching statements • Loop statements
Typology: Lecture notes
1 / 39
This page cannot be seen from the preview
Don't miss anything!
































1
Agenda
4
Simple Program #include <stdio.h> int main( int argc, char** argv ) { printf("Hello, World!\n"); return 0; }
C comments Identical to Java (Comp 210)! // Comment a single line /* Comment multiple lines */
Software program!
Important flags used by GCC:
10 read and write
Standard Output (stdout)
13 32 - bit System
Typical Types (Size and Range) Type Storage size Value range char 1 byte - 128 to 127 or 0 to 255 (system dependent) unsigned char 1 byte 0 to 255 signed char 1 byte - 128 to 127 int 4 bytes - 2,147,483,648 to 2,147,483, unsigned int 4 bytes 0 to 4,294,967, short 2 bytes - 32,768 to 32, unsigned short 2 bytes 0 to 65, long 8 bytes - 9223372036854775808 to 9223372036854775807 unsigned long 8 bytes 0 to 18446744073709551615
16 Declaration and Names
Variable declaration data type variable name; // without initialization e.g., int a;
19 global and local
Global Variable unsigned int x = 10; int main() { printf(”x = %d\n”, x ); func(); return 0; } void func() { printf(”x = %d\n”, x ); } 20 Global Variable