How to print in c








C language has given many predefined function to print any thing in console window, file etc. These predefined functions has been defined in the header file stdio.h
Some important functions are:

1. printf
2. cprintf
3. fprintf
4. vprintf
5. sprint
6. vfprintf
7. vsprintf
8. fputc
9. putc
10.        putw
11.        fputchar
12.        puts
13.        putchar
14.        fwrite


Explanation of most important functions are:
printf: It formatted function which prints in console window i.e. standard input device.
Example:

#include<stdio.h>
int main(){
    printf("Hello world");
    return 0;
}

putchar: It prints a single character on console window. For example:

#include<stdio.h>
int main(){
    int a = 5;
    putchar(a);
    return 0;
}

puts:
It prints a string on console window. For example:

#include<stdio.h>
int main(){
    char *str = "Hello world";
    puts(str);
    return 0;
}










No comments: