75.3k views
3 votes
Define a struct named PatientData that contains two integer data members named heightInches and weightPounds. Sample output for the given program with inputs 63 115: c language

1 Answer

2 votes

Answer:

Following are program to this question:

#include <stdio.h> //defining hader file

struct PatientData //defining structure PatientData

{

int heightInches, weightPounds; //defining integer variable

};

int main() //defining main method

{

struct PatientData pd= {63,115}; //creating structure object and assign value

printf("%d %d", pd.heightInches, pd.weightPounds); //print value

return 0;

}

Output:

63 115

Step-by-step explanation:

The program to this question can be described as follows:

  • In this program, a structure "PatientData" is declared, in which two integer variables, that is "heightInches and weightPounds".
  • Then the main method is declared, inside the main method, structure object "pd" is created, that assigns a value, that is "63 and 115", and uses the print method, that prints its value.
User Astrofunkswag
by
4.8k points