[prog] strcutures containing structures...

sena emre senaemre at yahoo.com
Mon May 28 09:10:31 UTC 2007


Hello,
   
  I have a problem with structures containing structures.
   
  Simply, I have structures of the form 
   
  struct box{
    int w;
    int h; 
    int d;
  }:
   
  struct solution{
  int no;
  int quality;
  struct box Cargo[10];
  }
   
  solution B[20];
   
  How can I assign values to this structures?
   
  Is a loop like the one below appropriate for this use?
   
  for(int bc=0; bc<20; bc++)
     for(int f=0; f<10; f++)
         B[bc].Cargo[f].w = 10;
   
  Is there a shorter form of assigning values to this structure containing structure?
   
  Is there a better alternative to defining structures containing structures in C?
   
  Thanks for your help...
   
  SEMRE
   
   
   



       
---------------------------------
Get the free Yahoo! toolbar and rest assured with the added security of spyware protection. 


More information about the Programming mailing list