struct dynamic 2d array alloc

Reply

Join Date: Sep 2003
Posts: 81
Reputation: Valmian is an unknown quantity at this point 
Solved Threads: 0
Valmian Valmian is offline Offline
Junior Poster in Training

struct dynamic 2d array alloc

 
0
  #1
Sep 21st, 2003
ok.. here I am with a double pointer to a 2D array and I am copying the data from another struct in to this 2d struct array.
It gives me an illegal opperand error.
Code:
data.rows=polar.rows;
data.trace = (SQwPOL**)calloc(polar.width,sizeof (SQwPOL*));
for (int i=0; i<polar.width; i++)
{
data.trace[i]= (SQwPOL*)calloc(polar.width,sizeof (SQwPOL));
for (int a=0; a<data.rows; a++)
{

data.trace[i][a]=polar.ar[i].values[a]; //says it is an illeal opperand here
printf ("\nThe number copy #%d = %d, original #%d = %d",i,data.trace[i][a],i,polar.ar[i].values[a]);
}
}
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC