C Project
C Project
Project Report
1. Add a Student Record: This feature allows the user to input information about a new
student, including their name, registration number, and grade. The system assigns a unique
ID to each student.
2. View All Student Records: Users can view a list of all the student records currently
stored in the system. It displays each student's ID, name, registration number, and grade.
3. Search for a Student Record: This feature enables users to search for a specific
student record by entering the student's name. If a match is found, the system displays the
student's information.
4. Delete a Student Record: Users can delete a student record from the system by
entering the ID of the student they wish to remove.
Overall, this Student Record Management System provides basic functionalities for
managing student information, such as adding, viewing, searching, and deleting records.
2 Code
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define NAME_SIZE 50
#define GRADE_SIZE 5
#define REGISTRATION_SIZE 15
typedef struct {
int id;
char name[NAME_SIZE];
char grade[GRADE_SIZE];
char registrationNumber[REGISTRATION_SIZE];
} Student;
Student studentArray[MAX_STUDENTS];
int studentCount = 0;
} StudentNode;
void addStudent() {
Student newStudent;
newStudent.id = studentCount + 1;
studentArray[studentCount++] = newStudent;
StudentNode* newNode =
(StudentNode*)malloc(sizeof(StudentNode));
newNode->student = newStudent;
newNode->next = studentHead;
studentHead = newNode;
} else {
void viewStudents() {
current = current->next;
void searchStudent() {
char name[NAME_SIZE];
int found = 0;
if (strstr(current->student.name, name)) {
found = 1;
current = current->next;
if (!found) {
void deleteStudent() {
int id;
scanf("%d", &id);
prev = current;
current = current->next;
if (current != NULL) {
if (prev == NULL) {
studentHead = current->next;
} else {
prev->next = current->next;
free(current);
} else {
int main() {
int choice;
// Display the menu and prompt for user input until they choose to exit
do {
printf("5. Exit\n");
scanf("%d", &choice);
switch (choice) {
case 1:
addStudent();
break;
case 2:
viewStudents();
break;
case 3:
searchStudent();
break;
case 4:
deleteStudent();
break;
case 5:
printf("Exiting...\n");
break;
default:
return 0;
}
3. OUTPUT