xxxxxxxxxx
pre-processor directives
global declarations
main()
{
local variable deceleration
statement sequences
function invoking
}
xxxxxxxxxx
#include <stdio.h>
// Define a structure to represent a person
struct Person {
char name[50];
int age;
float height;
};
int main() {
// Declare a variable of type 'struct Person'
struct Person person1;
// Input data for the person
printf("Enter person's name: ");
scanf("%s", person1.name);
printf("Enter person's age: ");
scanf("%d", &person1.age);
printf("Enter person's height (in meters): ");
scanf("%f", &person1.height);
// Display the information
printf("\nPerson's Information:\n");
printf("Name: %s\n", person1.name);
printf("Age: %d years\n", person1.age);
printf("Height: %.2f meters\n", person1.height);
return 0;
}