Question: 1 . What is output by the program given below? #include #define NUM _ DATA 2 typedef struct Data _ struct { int ID; char

1. What is output by the program given below?
#include #define NUM_DATA 2
typedef struct Data_struct { int ID;
char type[8];
} Data;
int main(void){
Data idData[NUM_DATA]; int i;
idData[0].ID =0; strcpy(idData[0].type, "Public"); idData[1].ID =1; strcpy(idData[1].type, "Private"); printf("Total data: %d", NUM_DATA);
for (i =0; i < NUM_DATA; ++i){
printf(" ID: %d", idData[i].ID); printf(" type %s", idData[i].type);
}
return 0;
}
(a) Total data: 2 ID: 1 type: Private ID: 0 type: Public
(b) Total data: 4 ID: 1 type: Private ID: 0 type: Public
(c) Total data: 4 ID: 0 type: Public ID: 1 type: Private
(d) Total data: 2 ID: 0 type: Public ID: 1 type: Private

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Programming Questions!