Cheers chervil!
For the simplification part, excellent! I kinda was dancing around that in my float array but hadn't realized the link there yet (you'll see what I mean below). I've made those changes.
For the float array, I tried that code and compiled it. It works, and looks nice (I didn't know you could make arrays look like that) but it doesnt' display the addresses in the output as needed.
For instance that code looks like:
100 101 102 103 104 105 106 107......149
150 151 152 153 154 155 156 157.......200
|
After posting earlier, I played around and did even more research and made a bit of headway.
I've got:
1 2 3 4 5 6 7 8 9 10 11
|
//Float Array
float * f = new float [100];
f = new float; // dynamically allocate a float and load address into f
for(float f = 101; f < 201; f++)
{
cout <<"Float @ " << & f << " = " << f << endl;
cout << endl;
system("Pause");
cout << endl;
}
|
Which gives me the proper "output" format of:
Float @ 0x100 (made up hex address) = 101
(press enter to continue)
Float @ 0x100 (same as above) = 102
(press enter to continue)
Float @ 0x100 (same as above) = 103
(press enter to continue)
Float @ 0x100 (same as above) = 104
(press enter to continue)
etc.
|
Which is what I am supposed to have. My issue now is, shouldn't the address of the memory increment for each line? For instance, all 100 lines of my array have exactly the same address and I'm not sure if they are supposed to grow with each line in the array. Like shouldn't the pointer/reference (whichever it is I've used) move one memory slot up with each line?
As for the char array, it should be similar to the float in that it increments the same way, listing the memory for each line except the output reads = "a" and go "b", "c", "d"... "z", and then start again at "A", "B", "C", "D"... "Z" and then start again at lower case "a" -- continuing until it gets through 100 lines, as compared to 101, 102, 103, 104, etc. in the float. I think what you've provided is exactly what I meant (for incrementing), but I've read that when you hit "z" there is an issue, and I wouldn't be sure how to cycle over to the capitals from "z" - "A".