Thread: parse error?

  1. #1
    Registered User blackwyvern's Avatar
    Join Date
    Jan 2002
    Posts
    60

    parse error?

    I need to know why I am getting a parse error in the following code. I can't find anything wrong with it. I am using the Dev-C++ compiler. I get it right at the class newword[240]




    #include <stdio.h>
    #include <fstream.h>

    char uresponse[240];
    int menuselect;





    int main(int argc, char *argv[])

    class newword[240]
    {
    char type[240];
    char subtype[240];
    char adjectives[240];
    int likescale;
    char whylike[240];
    char whydislike[240];
    };

  2. #2
    Registered User
    Join Date
    Sep 2001
    Posts
    412

    Re: parse error?

    Originally posted by blackwyvern
    I need to know why I am getting a parse error in the following code. I can't find anything wrong with it. I am using the Dev-C++ compiler. I get it right at the class newword[240]




    #include <stdio.h>
    #include <fstream.h>

    char uresponse[240];
    int menuselect;





    int main(int argc, char *argv[])

    class newword[240]
    {
    char type[240];
    char subtype[240];
    char adjectives[240];
    int likescale;
    char whylike[240];
    char whydislike[240];
    };


    Look at the line right before it. If that's a prototype of main(), then you need a ';' at the end. If that's where the function should be, put at least the braces in.

    Oh, and you can't put the [240] in the class declaration; you can make an array of objects later, but not when you define the class itself.

  3. #3
    Registered User blackwyvern's Avatar
    Join Date
    Jan 2002
    Posts
    60
    Thank you very much. I can't describe how appreciative I am of all the senior members, or rather knowledgeable members, that help people struggling with certain aspects of programming. I know that is a thankless job most of the time, but I just want to tell you, Thanks!

  4. #4
    Registered User
    Join Date
    Sep 2001
    Posts
    412
    Hey, always glad to help =]

    We all started out not knowing these languages, the least someone like myself can do is pass along some of the info I've learned, and am still learning.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiling sample DarkGDK Program
    By Phyxashun in forum Game Programming
    Replies: 6
    Last Post: 01-27-2009, 03:07 AM
  2. How to monitor process creation?
    By markiz in forum Windows Programming
    Replies: 31
    Last Post: 03-17-2008, 02:39 PM
  3. Using VC Toolkit 2003
    By Noobwaker in forum Windows Programming
    Replies: 8
    Last Post: 03-13-2006, 07:33 AM
  4. C++ compilation issues
    By Rupan in forum C++ Programming
    Replies: 1
    Last Post: 08-22-2005, 05:45 AM
  5. Couple C questions :)
    By Divx in forum C Programming
    Replies: 5
    Last Post: 01-28-2003, 01:10 AM