R
Ravi I Singh
Hello,
I tried to compile the following program from a C++ tutorial web
page:
// exceptions
#include <iostream.h>
int main () {
char myarray[10];
try
{
for (int n=0; n<=10; n++)
{
if (n>9) throw "Out of range";
myarray[n]='z';
}
}
catch (char * str)
{
cout << "Exception: " << str << endl;
}
return 0;
}
It core dumps when I try to run it. Any ideas? Thanks in advance.
Ravi
I tried to compile the following program from a C++ tutorial web
page:
// exceptions
#include <iostream.h>
int main () {
char myarray[10];
try
{
for (int n=0; n<=10; n++)
{
if (n>9) throw "Out of range";
myarray[n]='z';
}
}
catch (char * str)
{
cout << "Exception: " << str << endl;
}
return 0;
}
It core dumps when I try to run it. Any ideas? Thanks in advance.
Ravi