C program without any semicollon

Discussion in 'C' started by HARIT, Aug 11, 2011.

  1. HARIT

    HARIT New Member

    Joined:
    Jul 16, 2011
    Messages:
    17
    Likes Received:
    0
    Trophy Points:
    0
    Write a C program without any semicollon (;)..:D
     
  2. NewsBot

    NewsBot New Member

    Joined:
    Dec 2, 2008
    Messages:
    1,267
    Likes Received:
    2
    Trophy Points:
    0
    Code:
    int main()
    {
        if(printf("Hello World"))
    }
     
  3. gpk kishore

    gpk kishore New Member

    Joined:
    Jun 30, 2011
    Messages:
    82
    Likes Received:
    0
    Trophy Points:
    0
    #include<stdio.h>
    #include<conio.h>
    void main()
    {
    if(Printf("C FANATIC"))
    getch();
    }


    by writing above if statement printf() function returns a non zero value
    but we have not given any statement under it so it will just print CFANATIC
     
  4. NewsBot

    NewsBot New Member

    Joined:
    Dec 2, 2008
    Messages:
    1,267
    Likes Received:
    2
    Trophy Points:
    0
    You have a semicolon in getch statement
     
  5. ASD

    ASD New Member

    Joined:
    Aug 9, 2011
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    0
    The same coding when written in vi editor of LINUX it will also work without a getch();
     
  6. ASD

    ASD New Member

    Joined:
    Aug 9, 2011
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    0
    Doesn't it require a return statement.........????
     
  7. gpk kishore

    gpk kishore New Member

    Joined:
    Jun 30, 2011
    Messages:
    82
    Likes Received:
    0
    Trophy Points:
    0
    sir(shabbir)
    actually getch statement is not compulsory
    i have written by mistake
    sorry
    for inconvemience
     
  8. gpk kishore

    gpk kishore New Member

    Joined:
    Jun 30, 2011
    Messages:
    82
    Likes Received:
    0
    Trophy Points:
    0
    sir(ASD)

    getch is just needed for turbo c compiler usually 3.0
    to show us output (i.e.., it has to read a key)
    sophisticated compilers need not need that
     
  9. HARIT

    HARIT New Member

    Joined:
    Jul 16, 2011
    Messages:
    17
    Likes Received:
    0
    Trophy Points:
    0
    What the Non-Zero value printf() returns ??
     
  10. HARIT

    HARIT New Member

    Joined:
    Jul 16, 2011
    Messages:
    17
    Likes Received:
    0
    Trophy Points:
    0
    Actually I am asked "How a C programe can be write without semicolon?"
    I think it indicates any processes by which we can capable to code any C programme without using semicollon....
     
  11. gpk kishore

    gpk kishore New Member

    Joined:
    Jun 30, 2011
    Messages:
    82
    Likes Received:
    0
    Trophy Points:
    0
    hello harit

    it actually returns a non zero value (i.e.., TRUE)
    but there are no statement under if statement
    so it will just print what it is in printf statement
     
  12. HARIT

    HARIT New Member

    Joined:
    Jul 16, 2011
    Messages:
    17
    Likes Received:
    0
    Trophy Points:
    0
    what the exact value(non-zero) returned by printf()....?
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice