Thread: Query Regarding printf()

  1. #1
    Registered User
    Join Date
    Apr 2008
    Posts
    1

    Query Regarding printf()

    Can we execute printf() statement without ; and without any error..if yes how?
    pls do reply..thnx
    can mail d solution 2 <<snipped>> also

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Sure. Just make printf call in a function - but you will need a semicolon SOMEWHERE in the code.

    Code:
    int dummyFunc(int arg)
    {
       return 0;
    }
    int main()
    {
        return dummyFunc(printf("Hello, World));
    }
    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >Can we execute printf() statement without ; and without any error..if yes how?
    Why would you want to? Is this another stupid homework assignment that has no bearing on learning C?
    My best code is written with the delete key.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. making it portable.....?
    By ShadeS_07 in forum C Programming
    Replies: 11
    Last Post: 12-24-2008, 09:38 AM
  2. get keyboard and mouse events
    By ratte in forum Linux Programming
    Replies: 10
    Last Post: 11-17-2007, 05:42 PM
  3. segmentation fault upon reload
    By yabud in forum C Programming
    Replies: 8
    Last Post: 12-18-2006, 06:54 AM
  4. Simple C question: user input to repeat a loop
    By evernaut in forum C Programming
    Replies: 2
    Last Post: 11-18-2006, 09:23 AM
  5. Drawing tables in C
    By stanoman in forum C Programming
    Replies: 5
    Last Post: 10-09-2003, 10:14 AM