Posts

Showing posts from February, 2024

DATA STRUCTURE AND APPLICATION[BCS304]

Image
AIM: 1A) Declare a calendar as an array of 7 elements (A dynamically Created array) to represent 7 days of a week. Each Element of the array is a structure having three fields. The first field is the name of the Day (A dynamically allocated String), The second field is the date of the Day (A integer), the third field is the description of the activity for a particular day (A dynamically allocated String). PROGRAM CODE: #include<stdio.h> #include<stdlib.h> #include<string.h> struct Day  {     char *dayName;     int d, m, y;     char *activityDescription; }; void create(struct Day *calendar) {     char *dayNames[] = {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"};     for (int i = 0; i < 7; ++i)     {         calendar[i].dayName = strdup(dayNames[i]);         size_t bufferSize = 256;         calendar[i].activityDes...