What will be the output of the following C code?
#include < stdio.h >
void main()
{
static int x;
printf(“x is %d”, x);
}
a) 0
b) 1
c) Junk value
d) Run time error
Answer: a
Related Posts
What will be the output of the following C++ code?
#include <iostream>
#include <string>
#include <cstdlib>
using namespace std;
int main(int argc, char const *argv[])
{
int &p;
int a = 5;
&p = a;
cout<< p;
return 0;
}What will be the output of the following C++ code?
#include <iostream>
#include <string>
#include <cstdlib>
using namespace std;
int main(int argc, char const *argv[])
{
int &q = 5;
cout<< q;
return 0;
}What are the references in C++?
Identify the correct sentence regarding inequality between reference and pointer.
What will be the output of the following C++ code?
#include <iostream>
using namespace std;
void print (char * a)
{
cout << a << endl;
}
int main ()
{
const char * a = “Hello world”;
print(const_cast (a) );
return 0;
}What will be the output of the following C++ code?
#include <iostream>
using namespace std;
int main()
{
int a = 9;
int & aref = a;
a++;
cout << “The value of a is ” << aref;
return 0;
}What does a reference provide?
Join The Discussion