What is %o in printf function in the C programming language?
We use a printf function with %o format specifier to display the value of an octal variable.
%o - It is used for calculating octal value.
Ex:
- #include<stdio.h>
- int main()
- {
- int i = 150;
- printf("Octal value is: %o",i);
- return 0;
- }
In the C programming language, there are various format specifier is present.
- %d -> It is used for the integer value.
- %c -> It is used for the character value.
- %f -> It is used for the floating value.
- %s -> It is used for string value.
Comments
Post a Comment