C vs
Interesting Topics
Learn the way to Implement the same logic in C and Python Programming languages at the same time.
Printing "Hello, World"
C Program
#include <stdio.h> int main() { printf("Hello, World\n"); return 0; }
Python Program
print("Hello, World")
Python program looks simple and one-liner isn’t it ? but, there are some differences to note and understand.
Similarities:
- Name of the function : In C program it is “printf” and in Python in it is “print”, but the both does the same job, that is to print text to the screen.
Differences:
- Header File : C program requires a header file ‘stdio.h’ to recognise and locate the ‘printf()’ from its library of functions.
- Main Function : C program requires a ‘main()’ to identify the starting point of the program (i.e., from where to start executing) and the rest of the program to be placed in a pair of ‘{ }’ brackets.
- Semi Colons : C program requires a ‘;’ at the end of each line, where as Python which is not required.