int *a;
a = malloc( 10.0 * sizeof( int ));
for (double i = 0.0; i < 10.0; i += 1.0;)
{
a[ i ] = i;
cout << *(a + i) << '\n';
}
Ohboy... Could be fun. And exciting. :)
Aside from that example, I actually had a programming assignment where we used FP for some calculations, then "forgot" to cast it back to int before writing it to memory. Apparently the memory location immediately after our variable was some kind of software reset key - if we ran the program in the debugger, it worked but gave strange results; if we ran it outside the debugger, it did the calculations and rebooted the machine.
Not something you want a missile defence system to do. |