programming-examples/c/Structures_and_unions/C program for Nesting of Structure.c
2019-11-15 12:59:38 +01:00

19 lines
390 B
C

#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);
}