





Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
The 'Hello World' program in both C and C++ versions, explains how to compile it as C++, and discusses using the standard library functions in C++. It covers the use of header files, pre-processor commands, and the main function.
Typology: Study notes
1 / 9
This page cannot be seen from the preview
Don't miss anything!






“Hello World”
A simple C++ (and C) program
Since you have had 2 semesters to
forget what you did in G51PRG
-^
-^
c
at the beginning and remove the
.h
#include
-^
In C++ they may not actually be files
-^
-^
gcc
test.cpp –lstdc++ -o test
g++
test.cpp –o test
Define a function called
main()
, which returns a value of
type ‘
int
’ and has two parameters called
argc
and
argv
Your program will start with a call to your ‘
main
’ function
argc
and
argv
specify the command line arguments
argc
is of type ‘
int
’ and is the count of arguments
char*
’s, or C-style strings
arguments
-^
char*
is a
pointer
to a character