Declarations and Initializations

Q1:
Point out the error in the following program.
#include<stdio.h>
struct emp
{
    char name[20];
    int age;
};
int main()
{
    emp int xx;
    int a;
    printf('%d\n', &a);
    return 0;
}

A
Error: in printf

B
Error: in emp int xx;

C No error.

D None of these.

ANS:A -

Error: in printf

There is an error in the line emp int xx; To overcome this error, remove the int and add the struct at the begining of emp int xx;
#include<stdio.h>
struct emp
{
    char name[20];
    int age;
};
int main()
{
    struct emp xx;
    int a;
    printf('%d\n', &a);
    return 0;
}



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.