Module 3 : Array (Static)
By the end of this module, students will be able to:
- Understand the fundamental differences between Python lists and C arrays
- Declare and initialize static arrays with appropriate data types
- Access and manipulate array elements using indexing
- Implement common array operations (traversal, searching, sorting)
- Work with multi-dimensional arrays
- Apply string manipulation using character arrays
- Debug common array-related errors and memory issues
- Transition effectively from Python list operations to C array operations
1. Introduction: From Python Lists to C Arrays
1.1 Key Differences Overview Aspect Python Lists C Arrays Size Dynamic (can grow/shrink) F...
2. Array Declaration and Initialization
2.1 Basic Array Declaration Python vs C Comparison: Python C numbers = [1, 2, 3, 4, 5] int...
3. Array Indexing and Access
3.1 Basic Indexing Python vs C Indexing: Operation Python C First element list[0] array[0]...
4. Array Input and Output Operations
4.1 Reading Array Elements 4.1.1 Reading with Known Size #include <stdio.h> int main() { int...
5. Common Array Operations
5.1 Array Traversal 5.1.1 Forward Traversal // Python equivalent: for item in list: for (int i = ...
6. Mathematical Operations on Arrays
6.1 Statistical Operations 6.1.1 Sum and Average #include <stdio.h> int sum_array(int arr[], int...
7. Character Arrays and Strings
7.1 Character Arrays vs Strings Understanding C Strings: In C, strings are arrays of characters t...
8. Multi-dimensional Arrays
8.1 Two-Dimensional Arrays 8.1.1 Declaration and Initialization // Declaration int matrix[3][4]; ...