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

C / C++ / MFC

 
Questionproblem walking all over an array Pin
pblais22-Jun-06 9:04
pblais22-Jun-06 9:04 
AnswerRe: problem walking all over an array Pin
Zac Howland22-Jun-06 9:27
Zac Howland22-Jun-06 9:27 
GeneralRe: problem walking all over an array Pin
pblais22-Jun-06 10:21
pblais22-Jun-06 10:21 
GeneralRe: problem walking all over an array Pin
David Crow23-Jun-06 3:49
David Crow23-Jun-06 3:49 
GeneralRe: problem walking all over an array Pin
pblais23-Jun-06 10:53
pblais23-Jun-06 10:53 
GeneralRe: problem walking all over an array Pin
Zac Howland25-Jun-06 8:45
Zac Howland25-Jun-06 8:45 
GeneralRe: problem walking all over an array Pin
pblais26-Jun-06 9:06
pblais26-Jun-06 9:06 
GeneralRe: problem walking all over an array Pin
Zac Howland26-Jun-06 9:28
Zac Howland26-Jun-06 9:28 
pblais wrote:

char data_1[] = {1,1,12,0};<br />
<br />
char i_loop1 = 0;<br />
for(i_loop1 = 0; i_loop1 <= data_1[1] + 1; i_loop1++)<br />
data_1[3] ^= data_1[i_loop1];


This isn't the best way to initialize an element of an array (nor declare one actually). It likely isn't the cause of your problem, but very well could be if you ever changed the size of the array. A better way to write it would be:

<br />
// declare the actual array size<br />
// go ahead and initialize data_1[3] to correct value:<br />
// 0 ^ 1 = 1<br />
// 1 ^ 1 = 0<br />
// 0 ^ 12 = 12<br />
char data_1[4] = {1, 1, 12, 12};<br />


It is more efficient and decreases the chance for an error to sneak in the code.

For your second issue, if the next area in memory is getting trashed when you change the size of the array, look for something that is assuming a memory location (since this is a hardware simulation, I wouldn't be surprised to see a few). Also look for code similar the the segment above that writes to something out of bounds when dealing with the ROM_Buffer of a different size.

If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week

Zac
GeneralRe: problem walking all over an array Pin
pblais26-Jun-06 10:13
pblais26-Jun-06 10:13 
GeneralRe: problem walking all over an array Pin
Zac Howland26-Jun-06 10:25
Zac Howland26-Jun-06 10:25 
Questionabout printing formulars Pin
ivanris22-Jun-06 8:08
ivanris22-Jun-06 8:08 
Questionmultiple selections in List View (LVS) Pin
aafcls22-Jun-06 8:04
aafcls22-Jun-06 8:04 
AnswerRe: multiple selections in List View (LVS) Pin
Michael Dunn22-Jun-06 8:28
sitebuilderMichael Dunn22-Jun-06 8:28 
GeneralRe: multiple selections in List View (LVS) Pin
aafcls22-Jun-06 8:48
aafcls22-Jun-06 8:48 
GeneralRe: multiple selections in List View (LVS) Pin
Zac Howland22-Jun-06 9:40
Zac Howland22-Jun-06 9:40 
GeneralRe: multiple selections in List View (LVS) Pin
Michael Dunn22-Jun-06 10:45
sitebuilderMichael Dunn22-Jun-06 10:45 
GeneralRe: multiple selections in List View (LVS) Pin
aafcls23-Jun-06 4:02
aafcls23-Jun-06 4:02 
GeneralRe: multiple selections in List View (LVS) Pin
Michael Dunn23-Jun-06 15:01
sitebuilderMichael Dunn23-Jun-06 15:01 
QuestionTypedef Pin
Jay0322-Jun-06 7:59
Jay0322-Jun-06 7:59 
AnswerRe: Typedef Pin
Michael Dunn22-Jun-06 8:29
sitebuilderMichael Dunn22-Jun-06 8:29 
GeneralRe: Typedef Pin
Jay0322-Jun-06 8:36
Jay0322-Jun-06 8:36 
GeneralRe: Typedef Pin
Zac Howland22-Jun-06 9:33
Zac Howland22-Jun-06 9:33 
GeneralRe: Typedef Pin
Michael Dunn22-Jun-06 10:43
sitebuilderMichael Dunn22-Jun-06 10:43 
GeneralRe: Typedef Pin
Alexander M.,22-Jun-06 16:04
Alexander M.,22-Jun-06 16:04 
Questionlong data type with 64-bit Pin
Alexander M.,22-Jun-06 6:57
Alexander M.,22-Jun-06 6:57 

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.