Like Tree1Likes
  • 1 Post By GReaper

Hello comunity!

This is a discussion on Hello comunity! within the General Discussions forums, part of the Community Boards category; Code: #include <stdio.h> main (){ printf ("Hola\nMundo"); }...

  1. #1
    Registered User jfmarg's Avatar
    Join Date
    May 2012
    Location
    San Rafael, Mendoza, Argentina
    Posts
    3

    Hello comunity!

    Code:
    #include <stdio.h>
    
    main (){
    printf ("Hola\nMundo");
    }

  2. #2
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    1,602
    Use "int main(void)", "return 0;" at the end.
    Matticus likes this.
    Devoted my life to programming...

  3. #3
    Unregistered User Yarin's Avatar
    Join Date
    Jul 2007
    Posts
    1,534
    Your printf argument should end with a \n, to flush the last word/line.
    A class that doesn't overload all operators just isn't finished yet. -- SmugCeePlusPlusWeenie
    A year spent in artificial intelligence is enough to make one believe in God. -- Alan J. Perlis

  4. #4
    Registered User
    Join Date
    Oct 2006
    Posts
    2,144
    doesn't stdout automatically flush at the termination of the program?

  5. #5
    Unregistered User Yarin's Avatar
    Join Date
    Jul 2007
    Posts
    1,534
    Quote Originally Posted by Elkvis View Post
    doesn't stdout automatically flush at the termination of the program?
    Yes, but relying on that feature isn't good practice.
    A class that doesn't overload all operators just isn't finished yet. -- SmugCeePlusPlusWeenie
    A year spent in artificial intelligence is enough to make one believe in God. -- Alan J. Perlis

  6. #6
    Registered User
    Join Date
    Oct 2006
    Posts
    2,144
    is it just a common feature, or is it defined by some standard?

  7. #7
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    20,968
    Quote Originally Posted by jfmarg
    Hello comunity!
    They usually call me "laserlight" rather than "comunity" around here, but... hi!

    Quote Originally Posted by Elkvis
    is it just a common feature, or is it defined by some standard?
    Well...
    Quote Originally Posted by C99 Clause 7.19.3 Paragraph 5 (part)
    If the main function returns to its original caller, or if the exit function is called, all open files are closed (hence all output streams are flushed) before program termination. Other paths to program termination, such as calling the abort function, need not close all files properly.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21