Learning C-Style C++


by Direct Approach Mentoring



main() #include

1. Empty Program

Here is a program that does nothing, but is a good starting point for writing your programs:

#include
<stdio.h>

#include
<stdlib.h>

#include
<conio.h>


main()
{
  ;
}


C and C++ programs start at

main()

. The code block right below

main()

is the main function. The program will stop when it reaches the end of this code block.
Remember that a code block is lines of code between open and close curly braces:

{ }


Code blocks are nothing more than a way to group code together in one place.


The #include lines at the top copy code into your program from libraries. Included code allows you to use cool functions, for example, to write text on the screen.



Next: 2. Types