0% found this document useful (0 votes)
88 views3 pages

Yes No Questions

The document discusses NULL pointers and differences between NULL and uninitialized pointers. It provides questions about NULL pointer assignment and compatibility, and whether programs using void and other pointer conversions will compile in Turbo C.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
88 views3 pages

Yes No Questions

The document discusses NULL pointers and differences between NULL and uninitialized pointers. It provides questions about NULL pointer assignment and compatibility, and whether programs using void and other pointer conversions will compile in Turbo C.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

1.

Is there any difference between the following two statements?


char *p=0;
char *t=NULL;
A
Yes
.
Answer & Explanation

B.No

Answer: Option B
Explanation:
NULL is #defined as 0 in the 'stdio.h' file. Thus, both p and t are NULL pointers.
View Answer C Compiler Report Discuss in Forum
2.
Is this a correct way for NULL pointer assignment?
int i=0;
char *q=(char*)i;
A
Yes
.
Answer & Explanation

B.No

Answer: Option B
Explanation:
The correct way is char *q=0 (or) char *q=(char*)0
View Answer C Compiler Report Discuss in Forum
3.
Is the NULL pointer same as an uninitialised pointer?
A
Yes
.
Answer & Explanation
Answer: Option B
Explanation:

B.No

No answer description available for this question. Let us discuss.


View Answer C Compiler Report Discuss in Forum
4.
Will the program compile in Turbo C?
#include<stdio.h>
int main()
{
int a=10, *j;
void *k;
j=k=&a;
j++;
k++;
printf("%u %u\n", j, k);
return 0;
}

A
Yes
.
Answer & Explanation

B.No

Answer: Option B
Explanation:
Error in statement k++. We cannot perform arithmetic on void pointers.
The following error will be displayed while compiling above program in TurboC.
Compiling PROGRAM.C:
Error PROGRAM.C 8: Size of the type is unknown or zero.
View Answer C Compiler Report Discuss in Forum
5.
Will the following program give any warning on compilation in TurboC (under
DOS)?
#include<stdio.h>
int main()
{
int *p1, i=25;
void *p2;
p1=&i;
p2=&i;
p1=p2;
p2=p1;

return 0;

A
Yes
.
Answer & Explanation

B.No

Answer: Option B
Explanation:
No answer description available for this question. Let us discuss.
View Answer C Compiler Report Discuss in Forum

2008-201

You might also like