943,644 Members | Top Members by Rank

Ad:
  • C Discussion Thread
  • Unsolved
  • Views: 12501
  • C RSS
Sep 21st, 2003
0

struct dynamic 2d array alloc

Expand Post »
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]);
}
}
Similar Threads
Reputation Points: 13
Solved Threads: 0
Junior Poster in Training
Valmian is offline Offline
82 posts
since Sep 2003

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C Forum Timeline: printf buffer strange behaviur
Next Thread in C Forum Timeline: for loops





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC