Complicated Declarations Questions and Answers updated daily – C Language



15 Complicated Declarations Questions and answers section with explanation for various online exam preparation, various interviews, C Language Complicated Declarations online test. Complicated Declarations Questions with detailed description, explanation will help you to master the topic.

Complicated Declarations Questions

1.
What will be the output of the program?

#include<stdio.h>

int main()
{
    char huge *near *far *ptr1;
    char near *far *huge *ptr2;
    char far *huge *near *ptr3;
    printf("%d, %d, %dn", sizeof(ptr1), sizeof(*ptr2), sizeof(**ptr3));
    return 0;
}



SHOW ANSWER
Correct Ans:4,4,4
Explanation:


2.
     What will be the output of the program?

#include
typedef void v;
typedef int i;

int main()
{
    v fun(i, i);
    fun(2, 3);
    return 0;
}
v fun(i a, i b)
{
    i s=2;
    float i;
    printf("%d,", sizeof(i));
    printf(" %d", a*b*s);
}



SHOW ANSWER
Correct Ans:4,12
Explanation:


3.
What will be the output of the program?

#include<stdio.h>

int main()
{
    char huge *near *far *ptr1;
    char near *far *huge *ptr2;
    char far *huge *near *ptr3;
    printf("%d, %d, %dn", sizeof(**ptr1), sizeof(ptr2), sizeof(*ptr3));
    return 0;
}



SHOW ANSWER
Correct Ans:4,4,4
Explanation:


4.
What will be the output of the program in DOS (Compiler - Turbo C)?

#include<stdio.h>
double i;

int main()
{
    (int)(float)(char) i;
    printf("%d", sizeof((int)(float)(char)i));
    return 0;
}



SHOW ANSWER
Correct Ans:2
Explanation:
Due to the C language is being platform dependent:

In Turbo C (DOS - 16 bit platform), the output will be 2.

But in GCC (Unix/Linux - 32 bit platform), the output will be 4.


5.
What will be the output of the program?

#include<stdio.h>

int main()
{
    char far *near *ptr1;
    char far *far *ptr2;
    char far *huge *ptr3;
    printf("%d, %d, %dn", sizeof(ptr1), sizeof(ptr2), sizeof(ptr3));
    return 0;
}



SHOW ANSWER
Correct Ans:2,4,4
Explanation:


6.
    What do the following declaration signify?

char *scr;



SHOW ANSWER
Correct Ans:scr is a pointer to char.
Explanation:


7.
What do the following declaration signify?

char **argv;



SHOW ANSWER
Correct Ans:argv is a pointer to a char pointer.
Explanation:


8.
What do the following declaration signify?

void (*cmp)();



SHOW ANSWER
Correct Ans:cmp is a pointer to a function which returns void .
Explanation:


9.
What do the following declaration signify?

int *f();



SHOW ANSWER
Correct Ans:f is a function returning pointer to an int
Explanation:


10.
Declare the following statement?
"A pointer to a function which receives an int pointer and returns float pointer".



SHOW ANSWER
Correct Ans:float *(*ptr)(int*)
Explanation:


11.
What do the following declaration signify?

int (*pf)();



SHOW ANSWER
Correct Ans:pf is a pointer to a function which return int
Explanation:


12.
What do the following declaration signify?

char *arr[10];



SHOW ANSWER
Correct Ans:arr is a array of 10 character pointers.
Explanation:


13.
Declare the following statement?
"A pointer to an array of three chars".



SHOW ANSWER
Correct Ans:char (*ptr)[3];
Explanation:


14.
What do the following declaration signify?

int *ptr[30];



SHOW ANSWER
Correct Ans:ptr is a array of 30 pointers to integers.
Explanation:


15.
Declare the following statement?
"An array of three pointers to chars".



SHOW ANSWER
Correct Ans:char *ptr[3];
Explanation:



FreshersLive - No.1 Job site in India. Here you can find latest 2017 government as well as private job recruitment notifications for different posts vacancies in India. Get top company jobs for both fresher and experienced. Job Seekers can get useful interview tips, resume services & interview Question and answer. Practice online test free which is helpful for interview preparation. Register with us to get latest employment news/rojgar samachar notifications. Also get latest free govt and other sarkari naukri job alerts daily through E-mail.