C Basics ▶
1. Introduction to C
2. History & Features
3. Installation & Setup
4. Structure of C Program
5. Data Types
6. Variables
7. Constants
8. Operators
9. Input & Output
10. Control Statements
11. Loops
12. Break & Continue
13. Arrays
14. Strings
15. Functions
Pointers & Memory ▶
16. Pointers Basics
17. Pointer Arithmetic
18. Arrays & Pointers
19. Pointers to Functions
20. Dynamic Memory Allocation
21. malloc & calloc
22. realloc & free
23. Memory Leaks
24. 2D Arrays & Pointers
25. Pointer Mini Project
Structures, Unions & Files ▶
26. Structures
27. Nested Structures
28. Unions
29. Enums
30. typedef
31. File Handling Basics
32. File Operations
33. Reading & Writing Files
34. Binary Files
35. File Handling Project
Data Structures & Algorithms ▶
36. Introduction to DSA
37. Linked Lists
38. Stacks
39. Queues
40. Trees
41. Binary Search Tree
42. Sorting Algorithms
43. Searching Algorithms
44. Graph Basics
45. DSA Mini Project
Advanced C & Projects ▶
DSA Mini Project in C
Congratulations 🎉 You have reached the final lesson of the Data Structures & Algorithms section.
So far, you have learned:
- Arrays, linked lists, stacks and queues
- Trees and binary search trees
- Sorting and searching algorithms
- Basic graph concepts
In this lesson, we will combine multiple concepts into one meaningful mini project.
Project Title
Student Record Search System
This project simulates how real systems store and search data efficiently.
Project Requirements
- Store student roll numbers in an array
- Sort the data using a sorting algorithm
- Search a student using binary search
- Display results clearly
Step 1: Sample Data
We will work with student roll numbers:
int students[6] = {45, 12, 78, 34, 23, 56};
Step 2: Sorting the Data
We first sort the array using Bubble Sort.
void bubbleSort(int a[], int n) {
int i, j, temp;
for (i = 0; i < n - 1; i++) {
for (j = 0; j < n - i - 1; j++) {
if (a[j] > a[j + 1]) {
temp = a[j];
a[j] = a[j + 1];
a[j + 1] = temp;
}
}
}
}
Step 3: Searching the Student
Now we apply binary search.
int binarySearch(int a[], int n, int key) {
int low = 0, high = n - 1, mid;
while (low <= high) {
mid = (low + high) / 2;
if (a[mid] == key)
return mid;
else if (key < a[mid])
high = mid - 1;
else
low = mid + 1;
}
return -1;
}
Step 4: Complete Program
#include <stdio.h>
void bubbleSort(int a[], int n);
int binarySearch(int a[], int n, int key);
int main() {
int students[6] = {45, 12, 78, 34, 23, 56};
int key, pos;
bubbleSort(students, 6);
printf("Enter roll number to search: ");
scanf("%d", &key);
pos = binarySearch(students, 6, key);
if (pos != -1)
printf("Student found at position %d", pos + 1);
else
printf("Student not found");
return 0;
}
What You Practiced in This Project
- Array manipulation
- Sorting logic
- Binary search
- Modular programming
- Real-world thinking
Mini Practice
- Add student names using structures
- Allow searching by name
- Display sorted records