First
Interesting Topics
C Program
</p>
#include <stdio.h>
int main()
{
printf("Hello, World\n");
return 0;
}
<p>
C++ Program
</p>
#include <iostream>
using namespace std;
int main()
{
cout << "Hello, World" << endl;
return 0;
}
<p>
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