Question: Define a function SetBirth, with int parameters monthVal and dayVal, that returns a struct of type BirthMonthDay. The function should assign BirthMonthDay's data member month

 

Define a function SetBirth, with int parameters monthVal and dayVal, that returns a struct of type BirthMonthDay. The function should assign BirthMonthDay's data member month with monthVal and day with dayVal.

#include

typedef struct BirthMonthDay_struct {
int month;
int day;
} BirthMonthDay;

/* Your solution goes here */

int main(void) {
BirthMonthDay studentBirthday;
int month;
int day;

scanf("%d %d", &month, &day);
studentBirthday = SetBirth(month, day);
printf("The student was born on %d/%d.", studentBirthday.month, studentBirthday.day);

return 0;
}

 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To implement the SetBirth function that assigns values to a BirthMonthDay struct you need to define ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related General Management Questions!