It is predefined fn which is declared in < stdio.h >
By using predefined fn, we can print the data on console.
When we are working with printf ( ) function, it can take any no.of arguments but first asg must be starting constant & remaining arguments all separated by comma.
Within the “ “ double quotes, whatever we pass, it bring it like that only, if any format specifies are these, then copy that type of data.
Syntax: -
Designing a prog on Linux OS
# include < stdio.h >
Int main ( )
{
Printf (“ Students tutorials”)
Return.o;
}
o/p: Students tutorials
Void main ( ) | Void |
---|---|
{ | Main |
Print (“welcome) | ( |
} | ) |
o/p: Error | { |
Within the double quotes of a print F everything is treated like normal characters only except format specifiers & special characters.
In print F statement when we are passing an additional format specified which doesn’t have corresponding value then it brings some unknown or undefined value called garbage / junk.
In print f when we are passing an additional value. Which doesn’t have corresponding format specifies then that value is ignored because format specifies only decided data what type of data is required to print on console.
Void main ( )
{
A = 10;
Print f (“a = % d”, a);
}
Error: undefined symbol ‘a’
Void main ( )
{
Int a; // variable declaration
A= 10; // Assignment
Print f (“a= % d”. a);
}
O/p: a= 10