Tuesday, 21 September 2010

memcpy from an array.


found error. seems working.

array 1 dimensional array.
want copy 100 points follow array[40] another_array.
can without restructuring array?

memcpy(another_array, ??, 100*sizeof(float));

tried memcpy(another_array, &array[40], 100*sizeof(float));
actual code.
code:
 float **sprow; sprow = (float **) calloc(focplwidth , sizeof(float*)); 	for (i = 0; < focplwidth; i++); 	sprow[i] = (float*) calloc(focplwidth, sizeof(float));   for(fpy = 0; fpy < focplwidth; fpy++) 	{	 	memcpy(sprow[fpy], &dbuf[lensy*focplwidth], focplwidth*sizeof(float));	 	 		} 	 
 

code:
void *      memcpy(void *restrict s1, const void *restrict s2, size_t n);
why passing pointer pointer second argument when requires pointer ?

&dbuf[] translates void **...

also, sprow float **, again you're passing void *, points float * instead of float. you're specifying copy size of float it... sure float * , float same size on system ?

:confused:

lot wrong code.
 


Forums Macs Mac Programming


  • iPhone
  • Mac OS & System Software
  • iPad
  • Apple Watch
  • Notebooks
  • iTunes
  • Apple ID
  • iCloud
  • Desktop Computers
  • Apple Music
  • Professional Applications
  • iPod
  • iWork
  • Apple TV
  • iLife
  • Wireless

No comments:

Post a Comment