Fundamentals of Computer Programming -
Detailed Notes
Unit I: Computer Fundamentals
Data vs Information: Data is raw facts, Information is processed data with meaning.
Computer Components: CPU (ALU + CU + Registers), Memory (Primary - RAM, ROM; Secondary -
HDD, SSD), I/O Devices.
Software Types: System software (OS, Compiler), Application software (Word, Excel), Utilities.
Operating System: Interface between user and hardware; manages memory, processes, devices.
Programming Languages: Machine, Assembly, High-level (C, Java, Python).
Translators: Compiler (translates entire code at once), Interpreter (line by line), Assembler
(assembly to machine code).
Unit II: Problem Solving and C Basics
Problem Solving Steps: Analyze → Design Algorithm → Flowchart → Pseudocode → Coding →
Testing.
Algorithm: Step-by-step solution; e.g., Algorithm to add two numbers.
Flowchart: Graphical representation of steps using symbols (oval for start/stop, rectangle for
process, diamond for decision).
C Basics:
- Structure: #include , main() { }
- Keywords: int, float, char, return, if, else etc.
- Identifiers: Names for variables and functions.
- Data types: int, float, char, double, void.
- Operators: Arithmetic (+,-,*,/,%); Relational (==, !=, <, >); Logical (&&, ||, !); Bitwise (&, |, ^, <<,
>>).
Input/Output: printf(), scanf(). Example: printf('Hello World');
Unit III: Decision Making and Control Structures
Decision Making:
- if, if-else, nested if.
- else-if ladder: multiple conditions.
- switch-case: multi-way branching.
Loops:
- for loop: for(initialization; condition; update).
- while loop: checks condition before execution.
- do-while loop: executes at least once.
Jump Statements: break (exit loop), continue (skip iteration), goto (jump to label).
Example: for(i=0; i<5; i++) { printf('%d', i); }
Unit IV: Functions, Arrays, Strings, Pointers, Files
Functions:
- Library functions: printf(), scanf(), sqrt().
- User-defined: written by programmer.
- Recursion: function calling itself.
Arrays:
- 1D: int arr[5] = {1,2,3,4,5};
- 2D: int matrix[2][2] = {{1,2},{3,4}};
Strings:
- char str[10] = 'Hello';
- Functions: strlen(), strcpy(), strcmp(), strcat().
Pointers:
- Stores address of variable. Example: int *p, a=10; p=&a;
- Pointer arithmetic: p++, p--.
File Handling:
- fopen(), fclose(), fprintf(), fscanf(), fgetc(), fputc().
- Example: FILE *fp; fp=fopen('data.txt','w'); fprintf(fp,'Hello'); fclose(fp);