Aspire's Library

A Place for Latest Exam wise Questions, Videos, Previous Year Papers,
Study Stuff for MCA Examinations - NIMCET

Previous Year Question (PYQs)



The output of the following C++ Program is:
#include <stdio.h>
int main(void)
{
    int x, *p;
    x = 30;
    p = x;
    printf("%d", *p);
    return 0;
}





Solution

p is a pointer variable and must store the address of x, written as:


p = &x;


But the program assigns:


p = x;


which means an integer is assigned to a pointer, causing a compilation error (type mismatch).



Online Test Series,
Information About Examination,
Syllabus, Notification
and More.

Click Here to
View More


Online Test Series,
Information About Examination,
Syllabus, Notification
and More.

Click Here to
View More

Ask Your Question or Put Your Review.

loading...