programming-examples/c/Structures_and_unions/C program for Nesting of Structure.c

19 lines
390 B
C
Raw Normal View History

2019-11-15 12:59:38 +01:00
#include<stdio.h>
struct detail
{
char name[10];
float price;
};
struct item
{
int id;
struct detail d;
};
void main()
{
struct item itm;
printf("Enter item name, id and price ");
scanf("%s%d%f",itm.d.name,&itm.id,&itm.d.price);
printf("Entered details are:\n");
printf("Id: %d\nName: %s Price: %f", itm.id, itm.d.name, itm.d.price);
}