Home » C Programming » C-Library-Functions » Question
  1. What will be the output of the following C code?
    #include <stdio.h>
    int main()
    {
    printf("%d\n", srand(12000))
    return 0;
    }
    1. A double in the range 0 to 12000
    2. Compilation Error
    3. An integer in the range 0 to 12000
    4. A float in the range 0 to 1
    5. None of these
Correct Option: B

Compilation Error

main.c: In function ‘main’:
main.c:4:24: warning: implicit declaration of function ‘srand’; did you mean ‘scanf’? [-Wimplicit-function-declaration]
printf("%d\n", srand(12000))
^~~~~
scanf
main.c:5:9: error: expected ‘;’ before ‘return’
return 0;
^~~~~~



Your comments will be displayed only after manual approval.