Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Arrays in C++

Name: Anonymous 2012-11-12 21:48

So lets say I have an array, int array[3] = {123, 456, 789}.
If I wanted to take the first number of each value of the array and store it in another array, say int first[3];, how would I do that? I tried using a pointer to read the first memory address of each value of the array but it keeps returning the full array.

Name: Anonymous 2012-11-12 22:02

I think what you want, is an array {1, 4, 7}? If so, you'll have to do some shit with the modulus operator. %

So you'd say for this shit

int first[3] = {0, 0, 0};
for(int i = 0; i < 3; i++) {
    first[i] = array[i] % 100;
}

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List