First
Interesting Topics
C Program
#include <stdio.h> int main() { printf("Hello, World\n"); return 0; }
C++ Program
#include <iostream> using namespace std; int main() { cout << "Hello, World" << endl; return 0; }
Both programs looks pretty much similar isn’t it ? but, there are some differences to note and understand.
Similarities:
- #include : This is a Preprocessor directive, instructs the C/C++ compiler to “include some other file/code into current file/code, usually used to include header files” (stdio.h for C and iostream for C++ in this example).
- int main () :
- { and }
- return 0;
Differences:
- stdio.h
- iostream
- using namespace std;
- printf() and \n
- cout and endl