Printf Function
The printf is a standard C library function used for the formatted output. It is not a statement-like return but rather a function that takes a format string and a variable number of arguments. It displays formatted data to the console or other output streams and does not pass data between the functions.
Syntax
printf("format string", argument1, argument2, ...);
Example
C
// C program to illustrate printf #include <stdio.h> // function that prints value void foo() { printf ( "In the function" ); } // driver code int main() { foo(); return 0; } |
Output
In the function
Difference between return and printf in C
In C programming, return and print serve fundamentally different purposes and they are used in distinct contexts to achieve specific tasks. Let’s see each of them and see what are their functions and differences.
Contact Us