Code:
#include<stdio.h>
#include<string.h>
#include<conio.h>
// dish structure
 struct dishdetails
     {
     int dishid;
     char dishname[25];
     float dishprice;
     } ;
  // cuisine structure
     struct cuisinedetails
     {
     int cuisineid;
     char cuisinename[25];
     struct dishdetails d[20];
     } ;

void display(struct cuisinedetails )        ;
 
void main()
{
 
struct cuisinedetails c[4];
clrscr();
 

    c[0].cuisineid= 1;
    c[0].cuisinename = "Italian" ;

    c[0].d[0].dishid = 1;
    c[0].d[0].dishname = "Dosa";
    c[0].d[0].dishprice = 15.50;
    c[0].d[1].dishid = 2;
    c[0].d[1].dishname = "Idly";
    c[0].d[1].dishprice = 25.50;
    c[0].d[2].dishid = 3;
    c[0].d[2].dishname = "Wada";
    c[0].d[2].dishprice = 30.00;
    c[0].d[3].dishid = 4;
    c[0].d[3].dishname = "Sambhar";
    c[0].d[3].dishprice = 45.00;
 
      display(c[0]);
getch();
}

void display(struct cuisinedetails a)
{
printf("\n%d\t%s ", a.cuisineid,a.cuisinename);
printf("\n\n%d\t%s\t%f", a.d[0].dishid,a.d[0].dishname,a.d[0].dishprice);
printf("\n%d\t%s\t%f", a.d[1].dishid,a.d[1].dishname,a.d[1].dishprice);
printf("\n%d\t%s\t%f", a.d[2].dishid,a.d[2].dishname,a.d[2].dishprice);
printf("\n%d\t%s\t%f", a.d[3].dishid,a.d[3].dishname,a.d[3].dishprice);
}


I am Getting errors Lvalue required for the bold lines.
wher I m tring to assign a String name in an array of characters.
Please help me out.

Last edited by shabbir; 21Feb2009 at 09:12.. Reason: Code blocks