Subleties Of Typedef(C Programming ) Questions and Answers
Explanation:-
Answer: Option A. -> Yes
Explanation:-
Answer: Option A. -> Yes
Explanation:-
Answer: Option A. -> YesIn these declarations, s1, s2 and s3 are all treated as char*, but s4 is treated as a char,
Explanation:-
Answer: Option A. -> Yes
Explanation:-
Answer: Option B. -> Error: typedef cannot be used until it is defined
Question 6.
In the following code snippet can we declare a new typedef named ptr even though
struct employee has not been completely declared while using typedef?
typedef struct employee *ptr;
struct employee
{
char name[20];
int age;
ptr next;
}
- Yes
- No
Explanation:-
Answer: Option A. -> Yes
Explanation:-
Answer: Option B. -> 1
Explanation:-
Answer: Option C. -> 90.000000
Question 9.
What will be the output of the program?
#include<stdio.h>
int main()
{
typedef int LONG;
LONG a=4;
LONG b=68;
float c=0;
c=b;
b+=a;
printf("%d,", b);
printf("%f\n", c);
return 0;
}
- 72, 68.000000
- 72.000000, 68
- 68.000000, 72.000000
- 68, 72.000000
Explanation:-
Answer: Option A. -> 72, 68.000000
Question 10.
What will be the output of the program?
#include<stdio.h>
int main()
{
typedef int arr[5];
arr iarr = {1, 2, 3, 4, 5};
int i;
for(i=0; i
- 1, 2, 3, 4
- 1, 2, 3, 4, 5
- No output
- Error: Cannot use typedef with an array
Explanation:-
Answer: Option A. -> 1, 2, 3, 4