cout with manipulator "fixed" gives MemReadError
Hi everybody,
today I spent more than 1h to find this bug in my program. The problem is the following:
If I declare an array of doubles, do not initialize the array and then use cout with the manipulator "fixed" I get a segmentation fault.
If I initialize the array before using cout with "fixed" everything works fine. Why does an uninitialized array causes this error?
Here is my code:
Code:
using namespace std;
#include <iostream>
#include <conio.h>
int main (void)
{
double array[20];
for(int i=0; i<20; i++)
cout << array[i] << "\n";
for(int i=0; i<20; i++)
cout << fixed << array[i] << "\n";
return 0;
}
Thanks for your help!
greetings, nitron