Output in C

There are three major functions available in C standard library for achieving the output.

  1. printf
  2. putchar
  3. puts

printf() function

The printf() function can be used to print given data to console / terminal in specific format.

#include <stdio.h>

int main() {

    printf("Hello World");
    
    return 0;
}

Output

Hello World

putchar() function

The putchar() function can be used to print single char to console / terminal.

#include <stdio.h>

int main() {

    putchar('H');
    putchar('E');
    putchar('L');
    putchar('L');
    putchar('O');

    return 0;
}

Output

HELLO

puts() function

The puts() function can be used to print given data to console / terminal.

#include <stdio.h>

int main() {

    puts("Hello World");

    return 0;
}

Output

HELLO