What is the value of integer variable b, if we find programming statement like b=printf(“ES-CS201”);
Question
What is the value of integer variable b, if we find programming statement like b=printf(“ES-CS201”);
Solution
The value of the integer variable b in the statement b=printf(“ES-CS201”); would be the number of characters printed by the printf function.
Here's the step by step explanation:
-
The
printffunction in C programming language is used to print the "string" inside the brackets on the console. -
The
printffunction returns the number of characters that are printed. If any error occurs, it returns a negative value. -
In the statement
b=printf(“ES-CS201”);, the string "ES-CS201" has 8 characters. -
Therefore, the
printffunction will print "ES-CS201" and return the value 8. -
This returned value is then assigned to the integer variable
b.
So, the value of b will be 8.
Similar Questions
What will be the output of the following code snippet?1234567#include <stdio.h>int main() { int a = 5, b = 10; int result = a == b ? a + b : a - b; printf("%d", result); return 0;}
When using printf, which of the following is the format specifier for an integer?
What is the output of this statement printf(“%d”, (a++)); ?Answer areaA. The value of (a + 1)B. The current value of aC. Error messageD. Garbage
What will be the output of the following program?#include<stdio.h> int X=40; int main() { int X=20; printf("%d", X); return 0; }Select one:400Error20
In the below code -For what value of n does the program print 21 ?
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.