Header file:
stdio.h
Synopsis:
int printf(const char *format, ...);
Description:
It is equivalent to fprintf. Performs the formatted output conversion and writes the output to stdout. It gives us the number of characters printed (excludes '\0') as output.
printf function C example:
int main() {
int a = 10;
float b =10.11;
char ch = 'a', str[100] = "see-programming.blogspot.com";
printf("Integer a:%d\n",a);
printf("Float b:%f\n", b);
printf("Char ch:%c\nString str:%s\n", ch, str);
printf("Return value of printf: %d\n",
printf("Hello world\n"));
return 0;
}
Output:
jp@jp-VirtualBox:~/$ ./a.out
Integer a:10
Float b:10.110000
Char ch:a
String str:see-programming.blogspot.com
Hello world
Return value of printf: 12
Integer a:10
Float b:10.110000
Char ch:a
String str:see-programming.blogspot.com
Hello world
Return value of printf: 12
No comments:
Post a Comment