Home » C Programming » Variables » Question
  1. What will be the output of the following C code if these two files namely sample.c and sample1.c are linked and run?
     -------file sample.c-------
    #include <stdio.h>
    #include ""sample.h""
    int main()
    {
    n = 12;
    printf(""%d "", n);
    function();
    }

    -----file sample1.c------
    #include <stdio.h>
    #include ""sample.h""
    int function()
    {
    printf(""%d\n"", n);
    }

    -----file sample.h-----
    #include <stdio.h>
    #include <stdlib.h>
    static int n;
    1. 0 0
    2. 0 12
    3. 12 0
    4. 12 12
    5. None of these
Correct Option: C

12 0



Your comments will be displayed only after manual approval.