Click here to Skip to main content
15,890,506 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: Re initializing an array in C++ ? Pin
David Crow26-Dec-18 7:51
David Crow26-Dec-18 7:51 
AnswerRe: Re initializing an array in C++ ? Pin
Vaclav_26-Dec-18 8:20
Vaclav_26-Dec-18 8:20 
QuestionRe: Re initializing an array in C++ ? Pin
David Crow26-Dec-18 14:08
David Crow26-Dec-18 14:08 
AnswerRe: Re initializing an array in C++ ? Pin
Richard MacCutchan26-Dec-18 22:29
mveRichard MacCutchan26-Dec-18 22:29 
AnswerRe: Re initializing an array in C++ ? Pin
Vaclav_27-Dec-18 6:02
Vaclav_27-Dec-18 6:02 
GeneralRe: Re initializing an array in C++ ? Pin
Richard MacCutchan27-Dec-18 6:54
mveRichard MacCutchan27-Dec-18 6:54 
GeneralRe: Re initializing an array in C++ ? Pin
Victor Nijegorodov27-Dec-18 7:16
Victor Nijegorodov27-Dec-18 7:16 
AnswerRe: Re initializing an array in C++ ? Pin
Vaclav_27-Dec-18 9:09
Vaclav_27-Dec-18 9:09 
Here is the last modification of the code.
It fulfills the task to be able to reinitialize the array, actually passing a pointer with new data to called function.
The "test function" process / role was immaterial, as long as correct pointer with correct data was received. .

All replies were generaly helpful, which I appreciate.
Thanks.

Cheers

C++
int *pDataArray[32];
int a[] = {55, 1, 2, 3};
int iTestIndex = 0;

memcpy(pDataArray, a, sizeof(a));
do {
    cout << "index " << dec << iTestIndex; //  << endl;
    cout << " array 0x" << hex << +a[iTestIndex] << endl;
}while (iTestIndex++ != sizeof(a)/4); // temp /4

iTestIndex = 0;
do {
    cout << "index " << dec << iTestIndex; //  << endl;
    cout << " pDataArray  a " << hex << +pDataArray[iTestIndex] << endl;
    //} while (pDataArray[iTestIndex++]);
}while (iTestIndex++ != sizeof(a)/4);

int b[32] = {4, 5, 6};
memcpy(pDataArray, b, sizeof(b));
iTestIndex = 0;
do {
    cout << "index " << dec << iTestIndex << endl;
    cout << " pDataArray b " << hex << +pDataArray[iTestIndex] << endl;
    //} while (pDataArray[iTestIndex++]);
}while (iTestIndex++ != sizeof(b)/4);

GeneralRe: Re initializing an array in C++ ? Pin
Richard MacCutchan27-Dec-18 22:16
mveRichard MacCutchan27-Dec-18 22:16 
QuestionC programming Question on Characters Pin
Member 1409794322-Dec-18 7:12
Member 1409794322-Dec-18 7:12 
AnswerRe: C programming Question on Characters Pin
David Crow22-Dec-18 16:46
David Crow22-Dec-18 16:46 
GeneralRe: C programming Question on Characters Pin
Member 1409794322-Dec-18 20:32
Member 1409794322-Dec-18 20:32 
GeneralRe: C programming Question on Characters Pin
jschell23-Dec-18 7:44
jschell23-Dec-18 7:44 
GeneralRe: C programming Question on Characters Pin
David Crow23-Dec-18 12:50
David Crow23-Dec-18 12:50 
GeneralRe: C programming Question on Characters Pin
David Crow23-Dec-18 12:54
David Crow23-Dec-18 12:54 
AnswerRe: C programming Question on Characters Pin
jschell23-Dec-18 7:43
jschell23-Dec-18 7:43 
QuestionMessage Closed Pin
22-Dec-18 2:53
Alexander Kindel22-Dec-18 2:53 
AnswerRe: Spurious end of file error from ifstream::read Pin
Richard MacCutchan22-Dec-18 4:37
mveRichard MacCutchan22-Dec-18 4:37 
QuestionPostMessage fails with ERROR_NOT_ENOUGH_QUOTA (PROBLEM FOUND, thanks all) Pin
Maximilien19-Dec-18 4:53
Maximilien19-Dec-18 4:53 
QuestionRe: PostMessage fails with ERROR_NOT_ENOUGH_QUOTA Pin
David Crow19-Dec-18 5:13
David Crow19-Dec-18 5:13 
AnswerRe: PostMessage fails with ERROR_NOT_ENOUGH_QUOTA Pin
Maximilien19-Dec-18 6:45
Maximilien19-Dec-18 6:45 
AnswerRe: PostMessage fails with ERROR_NOT_ENOUGH_QUOTA Pin
Richard MacCutchan19-Dec-18 5:15
mveRichard MacCutchan19-Dec-18 5:15 
GeneralRe: PostMessage fails with ERROR_NOT_ENOUGH_QUOTA Pin
Maximilien19-Dec-18 6:46
Maximilien19-Dec-18 6:46 
GeneralRe: PostMessage fails with ERROR_NOT_ENOUGH_QUOTA Pin
Richard MacCutchan19-Dec-18 21:56
mveRichard MacCutchan19-Dec-18 21:56 
GeneralRe: PostMessage fails with ERROR_NOT_ENOUGH_QUOTA Pin
Maximilien20-Dec-18 2:04
Maximilien20-Dec-18 2:04 

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.