Professional Documents
Culture Documents
PCC La1
PCC La1
PCC La1
Output Screenshots
B)
C)
D)
F)
References 1. https://linuxsimply.com/linux-basics/package-management/update-
•Allow the user to input the number of employees to free memory for.
Perform memory deallocation accordingly and display the available
memory addresses.
int choice;
printf("Enter your choice: ");
scanf("%d", &choice);
switch (choice) {
case 1:
printf("Enter the number of employees to allocate memory for: ");
scanf("%d", &numEmployees);
allocateMemory(&employees, numEmployees);
break;
Program case 2:
if (employees != NULL) {
printf("Enter the number of employees to free memory for: ");
scanf("%d", &numEmployees);
freeMemory(&employees, numEmployees);
} else {
printf("No memory allocated yet.\n");
}
break;
case 3:
if (employees != NULL) {
displayAddresses(employees, numEmployees);
} else {
printf("No memory allocated yet.\n");
}
break;
case 4:
freeMemory(&employees, numEmployees); // Free memory before
exiting
printf("Exiting program.\n");
exit(0);
default:
printf("Invalid choice. Please enter a valid option.\n");
}
}
return 0;