Click to See Complete Forum and Search --> : Illegal Operation


tsacol
March 15th, 2003, 01:16 AM
The following code compiles fine but when I try to run the program an illegal operation message comes up. Does anybody know what the problem is, please email me at tsacole@hotmail.com.

cup
March 15th, 2003, 04:04 AM
You need to declare some space for frst_strg and scnd_strg before you use them. Basically they don't point anywhere.

// before the first while loop
frst_strg = new char[strlen(s) + 1];
scnd_strg = new char[strlen(s) + 1];

// before the getch
delete [] frst_strg;
delete [] scnd_strg;

Also, use

#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <conio.h>
using namespace std;

You don't need cstring.h as you are not doing any string manipulation.

tsacol
March 15th, 2003, 09:34 PM
Thanks very much, your help is really appreciated.