What will be the output of the following C code if these two files namely test.c and test1.c are linked and run? -------file test.c-------#include #include ""test.h""int main(){i = 10;printf(""%d "", i);foo();} -----file test1.c------#include #include ""test.h""int foo(){printf(""%d\n"", i);} -----file test.h-----#include #include static int i;

🎲 Try a Random Question  |  Total Questions in Quiz: 167  |  🧠 Study this quiz with Flashcards
This question is part of a full practice quiz:
C Programming Practice Test: C Functions and Structure of a Program — practice the complete quiz, review flashcards, or try a random question.

This C Prgramming quiz covers: Functions basics, external variables, variable scope, static and register variables, automatic variables, c-preprocessor, file inclusion, macro substitution and conditional inclusion. A function in C is a block of code that performs a specific task. Functions can take input in the form of parameters and can return a value or output. Functions can be called multiple times, which makes them reusable and modular. There are four types of user-defined functions divided on the basis of arguments they accept and the value they return: Function with no arguments and... Show more

What will be the output of the following C code if these two files namely test.c and test1.c are linked and run?<br> -------file test.c-------<br>#include <stdio.h><br>#include ""test.h""<br>int main()<br>{<br>i = 10;<br>printf(""%d "", i);<br>foo();<br>}<br> <br>-----file test1.c------<br>#include <stdio.h><br>#include ""test.h""<br>int foo()<br>{<br>printf(""%d\n"", i);<br>}<br> <br>-----file test.h-----<br>#include <stdio.h><br>#include <stdlib.h><br>static int i;