I'm wondering if anyone has experienced the same problem or has any input on it. I ran the following program:
and it outputs 3.14 twice, even though my professor demonstrated the array spilling into the variable in class. I tried to get some help from the VMware community but they weren't very helpful. Does anyone have any ideas?Code:#include <stdlib.h> #include <stdio.h> int main () { long int a[2]; double d = 3.14; printf("BEFORE: d = %.15g\n", d); a[2] = 1073741824; /* Out of bounds reference */ printf("AFTER: d = %.15g\n", d); return(EXIT_SUCCESS); }
--
Windows 7 64-bit
VMWare Workstation 8
Linux Mint 8 32-bit VM
(Also tried it with CentOS 6.2 64bit VM)