====== Computer Programming ====== This is an introductory course to computer programming for engineers. Knowledge of C programming is commonly accepted as of primary importance for an engineer. This knowledge can easily be translated to any other programming language. [[eec120_lab|Practical Exercise]] ====== Syllabus ====== - Introduction to Computer Systems - Hardware (CPU, input, output) - Software (Kernel, OS, userspace) - Numbers & Logic - Introduction to Computer Programming - Algorithms: instruction sequencing - Flow-charts: visual representation - Interpreters => scripts - Compiler and Linkers => binary executables - Introduction to C language - Basic code structure (syntax) - Function and code-block - Creating first executable binary - Syntax (language) and semantic (decision logic) errors - Variables and Operators - Flow control: Branches (selection) - Flow control: Loops (repetition) - Arrays - String (character array) - Pointers - Functions - scopes and variable life-time - File Access ====== Introduction to C Programming ====== ===== Variable and Operators ===== #include int main(void) { printf("Size of unsigned int: %d\n",sizeof(unsigned int)); printf("Size of unsigned long long: %d\n",sizeof(unsigned long long)); printf("Size of unsigned long: %d\n",sizeof(unsigned long)); printf("Size of unsigned short: %d\n",sizeof(unsigned short)); printf("Size of unsigned char: %d\n",sizeof(unsigned char)); return 0; } #include int main(void) { printf("Size of int: %d\n",sizeof(int)); printf("Size of float: %d\n",sizeof(float)); printf("Size of double: %d\n",sizeof(double)); printf("Size of long double: %d\n",sizeof(long double)); printf("Size of char: %d\n",sizeof(char)); return 0; }