in c code: in python

To write a simple "Hello, World!" program in Python:

main.py
print("Hello, World!")
23 chars
2 lines

To write the equivalent program in C:

#include <stdio.h>

int main() {
    printf("Hello, World!");
    return 0;
}
78 chars
7 lines

This program includes the standard input/output header file (<stdio.h>) and uses the printf() function to print the desired message to the console. The main() function is the entry point for the program and, in this case, simply prints the message and returns 0 to indicate successful completion.

gistlibby LogSnag