Skip to main content
Advertisement

C: Writing Your First Program

Let's use C's standard input and output to print a greeting to the screen.

💻 Hello World Example

#include <stdio.h>

int main() {
// Print a string to the console
printf("Hello, C Language Learning Center!\n");
return 0;
}

🔍 Code Detailed Explanation

  1. #include <stdio.h>

    • This is the Standard Input/Output header file. It must be included to use standard input/output functions like printf.
  2. int main()

    • This is the entry point of the program. Every C program must start execution from the main function.
  3. printf(...)

    • A function used to print formatted strings. \n represents a newline character.
  4. return 0;

    • A signal to the operating system indicating that the program has terminated successfully.
Advertisement