Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > General Computer Discussion > General Computer Support > problem with structs in c

Thread Tools

problem with structs in c

student student is offline
Junior Member
Join Date: Dec 2007
Posts: 1
hi ,

would u plz help me to find a solution for the problem in this code. it is in the last statement b4 return ( how can i assign to objects from the same type)
i am trying to create another instance of the object xx[] name yy.

any help will be highly appreciated

#include <iostream.h>
# include <stdio.h>
# include <stdlib.h>
int array[10] = {5,2,7,4,5,6,5,8,9,5};

struct mm
int (&d)[10],f;
int *arr;
: d( array )
struct x
mm m;

int siz,c,i;

x xx[2],yy;

int main()
{ for(i=0;i<2;i++)

xx[i].m.arr = new int[siz];
printf("\n---> %d\n",siz);

printf(" %d\n",xx[i].m.d[c]);

yy = xx[0]; // here is the problem
printf(" **%d\n",yy.m.f);
return 0;

i am trying to creat an other instance of the object xx[] name yy
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Packed structs vs. unpacked structs: what's the difference? Daniel Rudy C Programming 15 04-10-2006 08:10 AM
Array of structs instead of an array with pointers to structs? Paminu C Programming 5 10-11-2005 07:18 PM
length of an array in a struct in an array of structs in a struct in an array of structs Tuan Bui Perl Misc 14 07-29-2005 02:39 PM
const structs in other structs Chris Hauxwell C Programming 6 04-27-2004 07:03 PM
structs with fields that are structs Patricia Van Hise C Programming 5 04-05-2004 01:37 AM