Comparison of C against C++ – as a beginner
I started teaching myself how to program in C++ today, and here’s the code for the basic “Hello, world” program that everyone starts with, compared to C.
#include // this must be the basic header/footer file
std::cout << "Hello, world!\n"; // this means "print the words just after << "
return 0; // return an integer of 0
And now for C
printf("Hello, world!\n"); //Print the words in the brackets
C looks a lot clearer than C++, but I’m only starting! The book I’m using is called “Teach Yourself C++ in 24 Hours”, so in about 23 hours I’ll have a basic level of knowledge of how use it. Wish me luck…