Click here to Skip to main content
15,909,199 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionhow to assign an array value to another Pin
gentleguy25-Jan-08 22:55
gentleguy25-Jan-08 22:55 
AnswerRe: how to assign an array value to another [modified] Pin
CPallini25-Jan-08 23:30
mveCPallini25-Jan-08 23:30 
GeneralRe: how to assign an array value to another Pin
gentleguy26-Jan-08 0:18
gentleguy26-Jan-08 0:18 
GeneralRe: how to assign an array value to another Pin
CPallini26-Jan-08 1:59
mveCPallini26-Jan-08 1:59 
GeneralRe: how to assign an array value to another Pin
gentleguy26-Jan-08 2:17
gentleguy26-Jan-08 2:17 
QuestionRe: how to assign an array value to another Pin
CPallini26-Jan-08 2:26
mveCPallini26-Jan-08 2:26 
GeneralRe: how to assign an array value to another Pin
gentleguy26-Jan-08 2:29
gentleguy26-Jan-08 2:29 
GeneralRe: how to assign an array value to another Pin
CPallini26-Jan-08 2:58
mveCPallini26-Jan-08 2:58 
if you need to copy the whole 3x4 array you can use one of the following approaches:
(1) use an iteration over all the array elements, i.e. change from
gbest[i][3][4]=a[i][3][4];

(BTW, the above code is wrong, you're accessing elements out of the array boundaries)
to
for (j=0; j<3; j++)
  for (k=0; k<4; k++)
    gbest[i][j][k]=a[i][j][k];


(2) do a crude copy of memory, i.e. change
gbest[i][3][4]=a[i][3][4];

to

memcpy(&gbest[i], &a[i], 3*4*sizeof(a[0][0][0])); 


Smile | :)

If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.

[my articles]


GeneralRe: how to assign an array value to another Pin
gentleguy27-Jan-08 1:32
gentleguy27-Jan-08 1:32 
QuestionRe: how to assign an array value to another Pin
CPallini27-Jan-08 2:49
mveCPallini27-Jan-08 2:49 
GeneralChange Folder path Pin
Paulraj G25-Jan-08 20:54
Paulraj G25-Jan-08 20:54 
GeneralRe: Change Folder path Pin
Maxwell Chen25-Jan-08 21:52
Maxwell Chen25-Jan-08 21:52 
GeneralRe: Change Folder path Pin
David Crow26-Jan-08 12:04
David Crow26-Jan-08 12:04 
AnswerRe: Change Folder path Pin
Alain Rist26-Jan-08 20:17
Alain Rist26-Jan-08 20:17 
QuestionHow to login a website?post!method Pin
chinakknd25-Jan-08 20:51
chinakknd25-Jan-08 20:51 
AnswerRe: How to login a website?post!method Pin
Paul Conrad26-Jan-08 7:50
professionalPaul Conrad26-Jan-08 7:50 
QuestionAny Method to check if database provider is installed on a machine Pin
Mushtaque Nizamani25-Jan-08 20:46
Mushtaque Nizamani25-Jan-08 20:46 
QuestionRe: Any Method to check if database provider is installed on a machine Pin
CPallini26-Jan-08 0:12
mveCPallini26-Jan-08 0:12 
QuestionRe: Any Method to check if database provider is installed on a machine Pin
David Crow26-Jan-08 12:07
David Crow26-Jan-08 12:07 
GeneralAfter Selecting Activex Control the Application crashes... Pin
spalanivel25-Jan-08 18:49
spalanivel25-Jan-08 18:49 
Generalini file creation in windows mobile Pin
guru moorthy.k25-Jan-08 18:48
guru moorthy.k25-Jan-08 18:48 
GeneralRe: ini file creation in windows mobile Pin
Maxwell Chen25-Jan-08 21:55
Maxwell Chen25-Jan-08 21:55 
GeneralAccess Violation at ii=ii+1; all other variables print value correctly Pin
mrby12325-Jan-08 13:10
mrby12325-Jan-08 13:10 
QuestionRe: Access Violation at ii=ii+1; all other variables print value correctly Pin
David Crow25-Jan-08 17:13
David Crow25-Jan-08 17:13 
GeneralRe: Access Violation at ii=ii+1; all other variables print value correctly [modified] Pin
mrby12325-Jan-08 20:37
mrby12325-Jan-08 20:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.