#include <stdio.h>
#include <string.h>
/* structure definition */
struct Car /* name of the structure */
{
char make[20], model[20]; /* member or element of the structure */
float hp, avg; /* member or element of the structure */
long int price; /* member or element of the structure */
};
int main(void)
{
/* Declaring a struct variable */
struct Car m800;
/* Assign values to the members of the structure */
strcpy(m800.make, "Maruti");
strcpy(m800.model, "800");
m800.hp = 12.5;
m800.avg = 15;
m800.price = 200000;
/* Display values in the members of the structure */
printf("\nDisplaying values : ");
printf("\nMade by : %s", m800.make);
printf("\nModel : %s", m800.model);
printf("\nHorse power : %f", m800.hp);
printf("\nAverage : %f", m800.avg);
printf("\nCost : %ld", m800.price);
printf("\nSize of structure variable : %u", sizeof(m800));
return 0;
}
#include <string.h>
/* structure definition */
struct Car /* name of the structure */
{
char make[20], model[20]; /* member or element of the structure */
float hp, avg; /* member or element of the structure */
long int price; /* member or element of the structure */
};
int main(void)
{
/* Declaring a struct variable */
struct Car m800;
/* Assign values to the members of the structure */
strcpy(m800.make, "Maruti");
strcpy(m800.model, "800");
m800.hp = 12.5;
m800.avg = 15;
m800.price = 200000;
/* Display values in the members of the structure */
printf("\nDisplaying values : ");
printf("\nMade by : %s", m800.make);
printf("\nModel : %s", m800.model);
printf("\nHorse power : %f", m800.hp);
printf("\nAverage : %f", m800.avg);
printf("\nCost : %ld", m800.price);
printf("\nSize of structure variable : %u", sizeof(m800));
return 0;
}
No comments:
Post a Comment
kiss on google ads if you are anonymous because your ip is trackable.thank you.
......from.admin