Thread: Help!

  1. #1
    Registered User
    Join Date
    Jan 2002
    Location
    Vancouver
    Posts
    2,212

    Help!

    pls help i made this program it is supposed to INPUT a string like in the book and then it make the LASER PRINTER printf the document tell me what wrong

    #include <studio.h>
    #include <stdribs.h>

    void main()
    {
    char jay[500];
    open(PRINTER,"lpt1)
    scanf(%w,&*jay);
    print PRINTER "$jay";
    hello(jay);
    return jay;
    }

    void hello(char *jay)
    {
    if(!stricmp(jay,"WOBBLE")) // UH OH EXCEPTION PAGE FAULT
    {
    print ERROR "OH NO!";
    main();
    }

    }


    QUICKLY IT IS FOR MY HOMEWORK!

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826

    Re: Help!

    Originally posted by Brian
    tell me what wrong

    void main()
    {
    char jay[500];
    open(PRINTER,"lpt1)
    scanf(%w,&*jay);
    print PRINTER "$jay";
    hello(jay);
    return jay;
    }

    void hello(char *jay)
    {
    if(!stricmp(jay,"WOBBLE")) // UH OH EXCEPTION PAGE FAULT
    {
    print ERROR "OH NO!";
    main();
    }

    }
    QUICKLY IT IS FOR MY HOMEWORK!
    Good god. Where do I start?

    1) Main never returns void.
    2) Why are you dereferencing and then using the address of 'jay' in your scanf?
    3) What the hell is print? This line is horrible, unless you have some fancy macroing going on, and then I'd be hard pressed to say it'd work.
    4) You have main as void, and then you make it return a value. The value you try returning is also void from a void function. This is so wrong it's scary.
    5) Another horrible 'print' line.
    6) Never implicitly call main.
    7) No one cares how fast you need it done, honestly.

    That aside, at least you posted your attempt, so I applaud you on that.

    [edit]Correction on what I thought was an error due to line wrapping. Removed one bullet point.[/edit]

    Quzah.
    Last edited by quzah; 06-13-2003 at 01:43 PM.
    Hope is the first step on the road to disappointment.

  3. #3
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    I think this is a windup.....

  4. #4
    Registered User
    Join Date
    Oct 2002
    Posts
    385
    Wow, what a mess. I was starting to wonder exactly if this was C or not If a teacher/professor actually taught you to program like this then they should be beaten about the head and neck.
    Wandering aimlessly through C.....

    http://dbrink.phpwebhosting.com

Popular pages Recent additions subscribe to a feed