Library Functions

Q1:
What will be the output of the program?
#include<stdio.h>

int main()
{
    int i;
    i = scanf('%d %d', &i, &i);
    printf('%d\n', i);
    return 0;
}

A 1

B 2

C Garbage value

D Error: cannot assign scanf to variable

ANS:A - 1

scanf() returns the number of variables to which you are provding the input. i = scanf('%d %d', &i, &i); Here Scanf() returns 2. So i = 2. printf('%d\n', i); Here it prints 2.



img not found
img

For help Students Orientation
Mcqs Questions

One stop destination for examination, preparation, recruitment, and more. Specially designed online test to solve all your preparation worries. Go wherever you want to and practice whenever you want, using the online test platform.