0% found this document useful (0 votes)
44 views2 pages

A - B. C. D - Answer & Explanation

The document discusses two C programs that contain errors. The first program assigns a value to an uninitialized pointer variable, which would cause a crash. The second program incorrectly tries to increment the array variable instead of the index.
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)
44 views2 pages

A - B. C. D - Answer & Explanation

The document discusses two C programs that contain errors. The first program assigns a value to an uninitialized pointer variable, which would cause a crash. The second program incorrectly tries to increment the array variable instead of the index.
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/ 2

1.

Point out the compile time error in the program given below.
#include<stdio.h>
int main()
{
int *x;
*x=100;
return 0;
}

A
Error: invalid assignment for x
.
B.Error: suspicious pointer conversion
C.No error
D
None of above
.
Answer & Explanation
Answer: Option C
Explanation:
While reading the code there is no error, but upon running the program having an unitialised
variable can cause the program to crash (Null pointer assignment).
View Answer C Compiler Report Discuss in Forum
2.
Point out the error in the program
#include<stdio.h>
int main()
{
int a[] = {10, 20, 30, 40, 50};
int j;
for(j=0; j<5; j++)
{
printf("%d\n", a);
a++;
}
return 0;
}

A
Error: Declaration syntax
.

B.Error: Expression syntax

C.Error: LValue required

D
Error: Rvalue required
.

Answer & Explanation

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

You might also like