help me atleast now

Discussion in 'C Programming' started by muttaa, Mar 21, 2006.

  1. muttaa

    muttaa Guest

    i'm sorry for posting an incomplete code.

    here's the full listing.................


    #include<stdio.h>

    #include<conio.h>



    main()

    {

    clrscr();

    for(;0;)

    printf("Gud Morning");
    getch();
    return 0;
    }


    please explain the output............

    i compiled it in Turbo C++ (3.0) compiler which i'm sure enough that
    it's not broken.............
     
    muttaa, Mar 21, 2006
    #1
    1. Advertising

  2. muttaa

    Artie Gold Guest

    muttaa wrote:
    > i'm sorry for posting an incomplete code.
    >
    > here's the full listing.................
    >
    >
    > #include<stdio.h>
    >
    > #include<conio.h>


    Non-standard header. Not relevant here.
    >
    >
    >
    > main()


    Implicit int is deprecated in C90 and does not exist in C99. Prefer:
    int main(void)
    >
    > {
    >
    > clrscr();

    Non-standard function.
    >
    > for(;0;)
    >
    > printf("Gud Morning");
    > getch();

    Non-standard function.
    > return 0;
    > }
    >
    >
    > please explain the output............


    What output? Have you shown it to us?
    >
    > i compiled it in Turbo C++ (3.0) compiler which i'm sure enough that
    > it's not broken.............
    >

    Huh?

    HTH,
    --ag



    --
    Artie Gold -- Austin, Texas
    http://goldsays.blogspot.com
    "You can't KISS* unless you MISS**"
    [*-Keep it simple, stupid. **-Make it simple, stupid.]
     
    Artie Gold, Mar 21, 2006
    #2
    1. Advertising

  3. muttaa

    osmium Guest

    "muttaa" wrote:

    > i'm sorry for posting an incomplete code.
    >
    > here's the full listing.................
    >
    >
    > #include<stdio.h>
    >
    > #include<conio.h>
    >
    >
    >
    > main()
    >
    > {
    >
    > clrscr();
    >
    > for(;0;)
    >
    > printf("Gud Morning");
    > getch();
    > return 0;
    > }
    >
    >
    > please explain the output............
    >
    > i compiled it in Turbo C++ (3.0) compiler which i'm sure enough that
    > it's not broken.............


    Two problems.

    o We can not see the output
    o Most of us can not (or will not) compile it because it uses a non-standard
    header, conio.h

    It appears to be some kind of trick question with that odd for statement.
    Post it to a newsgroup that discusses your compiler, or convert it to
    standard C and post it again here. I don't think your real question
    requires conio to make it on topic on this newsgroup.
     
    osmium, Mar 21, 2006
    #3
  4. On 2006-03-21, muttaa <> wrote:
    > i'm sorry for posting an incomplete code.
    >
    > here's the full listing.................
    >
    >
    > #include<stdio.h>
    >
    > #include<conio.h>
    >
    >
    >
    > main()
    >
    > {
    >
    > clrscr();
    >
    > for(;0;)
    >
    > printf("Gud Morning");
    > getch();
    > return 0;
    > }
    >
    >
    > please explain the output............


    I assume you dont post the output because there is no output?

    >
    > i compiled it in Turbo C++ (3.0) compiler which i'm sure enough that
    > it's not broken.............
    >


    There should be no output. The "for" loop "condition" evaluates to 0
    or false and so the following statement ("printf") is not executed.

    Also remember its often better to but a newline character at the end
    of printfs. e.g

    printf("hello\n");

    This causes the text buffer to be output to the console screen in most
    cases. If you have a debugger learn to use it : you would see the code jump
    direct to the getch();

    Good luck
     
    Richard G. Riley, Mar 21, 2006
    #4
  5. muttaa

    santosh Guest

    muttaa wrote:
    > i'm sorry for posting an incomplete code.
    >
    > here's the full listing.................
    >
    >
    > #include<stdio.h>
    >
    > #include<conio.h>
    >
    >
    >
    > main()
    >
    > {
    >
    > clrscr();
    >
    > for(;0;)
    >
    > printf("Gud Morning");
    > getch();
    > return 0;
    > }
    >
    >
    > please explain the output............
    >
    > i compiled it in Turbo C++ (3.0) compiler which i'm sure enough that
    > it's not broken.............


    Frankly, I have no idea why your ompiler is behaving in this way.
    Maybe, the regulars here will be able to diagnose your problem better,
    but I suspect that they will be disinclined to do so, given the highly
    non-standard nature of your code snippet.

    If I may ask:
    Why are you using a ca. 1989 compiler? Since the both C and C++ have
    significantly changed. Why not use a more recent compiler like gcc?
     
    santosh, Mar 21, 2006
    #5
  6. muttaa

    CBFalconer Guest

    santosh wrote:
    >

    .... snip ...
    >
    > If I may ask: Why are you using a ca. 1989 compiler? Since the
    > both C and C++ have significantly changed. Why not use a more
    > recent compiler like gcc?


    The TC is available free from the Borland Museum, and is still
    useful for generating executables that can run on plain DOS. It is
    not far from standard if properly configured, which can make it a
    useful teaching tool. It is also useful for checking that code
    ports to 16 bit integer systems.

    --
    "If you want to post a followup via groups.google.com, don't use
    the broken "Reply" link at the bottom of the article. Click on
    "show options" at the top of the article, then click on the
    "Reply" at the bottom of the article headers." - Keith Thompson
    More details at: <http://cfaj.freeshell.org/google/>
    Also see <http://www.safalra.com/special/googlegroupsreply/>
     
    CBFalconer, Mar 21, 2006
    #6
  7. muttaa

    santosh Guest

    CBFalconer wrote:
    > santosh wrote:
    > >

    > ... snip ...
    > >
    > > If I may ask: Why are you using a ca. 1989 compiler? Since the
    > > both C and C++ have significantly changed. Why not use a more
    > > recent compiler like gcc?

    >
    > The TC is available free from the Borland Museum, and is still
    > useful for generating executables that can run on plain DOS. It is
    > not far from standard if properly configured, which can make it a
    > useful teaching tool. It is also useful for checking that code
    > ports to 16 bit integer systems.


    <OT>
    Fair enough, though the OP was using the C++ compiler and I guess C++
    *has* changed dramatically since that time period. As far as plain TC
    is concerned, yes it can probably be used as a simple, C89 compliant
    (?), development environment for 16 bit Intel platforms.
    </OT>
     
    santosh, Mar 22, 2006
    #7
  8. CBFalconer wrote:
    >
    > santosh wrote:
    > >

    > ... snip ...
    > >
    > > If I may ask: Why are you using a ca. 1989 compiler? Since the
    > > both C and C++ have significantly changed. Why not use a more
    > > recent compiler like gcc?

    >
    > The TC is available free from the Borland Museum, and is still
    > useful for generating executables that can run on plain DOS. It is
    > not far from standard if properly configured, which can make it a
    > useful teaching tool. It is also useful for checking that code
    > ports to 16 bit integer systems.


    Not to mention the fact that you can use "large model" to have 16-bit
    integers and 32-bit pointers. That'll catch sorts of things, like
    casting the return of malloc() because you didn't include the proper
    header file. And with 16-bit ints and 32-bit longs, it'll catch those
    places where you didn't prototype a function which takes a long as a
    parameter, like seek(). (By "catch", I mean "will hopefully fail
    miserably when you run it because of these". Obviously, they won't
    all be caught at compile time.

    --
    +-------------------------+--------------------+-----------------------------+
    | Kenneth J. Brody | www.hvcomputer.com | |
    | kenbrody/at\spamcop.net | www.fptech.com | #include <std_disclaimer.h> |
    +-------------------------+--------------------+-----------------------------+
    Don't e-mail me at: <mailto:>
     
    Kenneth Brody, Mar 22, 2006
    #8
  9. muttaa

    Al Balmer Guest

    On 21 Mar 2006 23:01:18 -0800, "santosh" <>
    wrote:

    >CBFalconer wrote:
    >> santosh wrote:

    <snip>
    >
    ><OT>


    <snip>

    You do realize that marking things <OT> does not make them suitable
    for publication in this newsgroup?

    Please, when a question is off-topic, say that, give some advice as to
    where to go, if you know, and *leave it at that*.

    --
    Al Balmer
    Sun City, AZ
     
    Al Balmer, Mar 22, 2006
    #9
  10. On 2006-03-22, Al Balmer <> wrote:
    > On 21 Mar 2006 23:01:18 -0800, "santosh" <>
    > wrote:
    >
    >>CBFalconer wrote:
    >>> santosh wrote:

    ><snip>
    >>
    >><OT>

    >
    ><snip>
    >
    > You do realize that marking things <OT> does not make them suitable
    > for publication in this newsgroup?
    >
    > Please, when a question is off-topic, say that, give some advice as to
    > where to go, if you know, and *leave it at that*.
    >


    A few comments on why someone programming C might want to use an old
    compiler to, possibly, support his code in 16 bit environments is not
    so widely off topic as to be worth censoring.

    In addition, and more importantly, it was not apparent immediately
    that it was a compiler issue as opposed to a c-language issue since he
    didnt post his output.
     
    Richard G. Riley, Mar 22, 2006
    #10
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. P R Sen
    Replies:
    2
    Views:
    360
    Andrew Thompson
    Oct 28, 2004
  2. Abhinav
    Replies:
    1
    Views:
    690
    Abhinav
    Jul 22, 2004
  3. Replies:
    0
    Views:
    491
  4. ANoobee
    Replies:
    3
    Views:
    391
  5. muttaa

    help me atleast now

    muttaa, Mar 21, 2006, in forum: C Programming
    Replies:
    25
    Views:
    765
    santosh
    Mar 22, 2006
Loading...

Share This Page