CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2003
    Location
    Auckland
    Posts
    9

    Illegal Operation

    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 [email protected].
    Attached Files Attached Files
    tsacol

  2. #2
    Join Date
    Jun 2002
    Location
    Letchworth, UK
    Posts
    1,020
    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.
    Succinct is verbose for terse

  3. #3
    Join Date
    Mar 2003
    Location
    Auckland
    Posts
    9
    Thanks very much, your help is really appreciated.
    tsacol

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured