| | |
struct dynamic 2d array alloc
![]() |
•
•
Join Date: Sep 2003
Posts: 81
Reputation:
Solved Threads: 0
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]);
}
}
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
- Dynamic array of pointers to structures - doubt (C++)
- Dynamic array of structures (C++)
- Dynamic Array Help (C)
- Dynamic array management (C)
- Dynamic Array of Structures, Loop problem! (C++)
- Creating dynamic array structures (C++)
- dynamic array of structures problem (C++)
Other Threads in the C Forum
- Previous Thread: printf buffer strange behaviur
- Next Thread: for loops
| Thread Tools | Search this Thread |
adobe api array arrays binarysearch calculate centimeter char cm convert copyanyfile copypdffile cprogramme createcopyoffile createprocess() csyntax directory dynamic feet fflush file floatingpointvalidation fork forloop frequency getlasterror givemetehcodez global graphics gtkgcurlcompiling hacking highest homework i/o inches incrementoperators intmain() iso kernel kilometer km linked linkedlist linux linuxsegmentationfault list locate logical_drives loopinsideloop. match matrix microsoft mqqueue mysql oddnumber odf open opendocumentformat openwebfoundation owf pattern pdf performance pointer posix power probleminc program programming pyramidusingturboccodes read recursion recv recvblocked repetition research scanf scheduling segmentationfault send shape single socketprograming socketprogramming stack standard strchr string suggestions systemcall test unix urboc user variable voidmain() wab whythiscodecausesegmentationfault win32api windows.h





