what would be the output of the following program?
main()
{
int k = 123;
char *ptr;
ptr = &k;
printf("%d",*ptr);
}

Answer Posted / srsabariselvan

The program results in compilation error.

NOTE: a pointer can stores the address of same data type.
it can't store the address of another data type.
i.e.,
character pointer can stores the address of character data.
it can't store the address of integer data.

Is This Answer Correct ?    2 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain how do you view the path?

891


What is difference between constant pointer and constant variable?

949


What is the difference between typedef and #define?

785


What does c in a circle mean?

793


Tell us two differences between new () and malloc ()?

865


Explain what is wrong with this program statement?

890


Why main is not a keyword in c?

933


What is main () in c?

812


Why #include is used in c language?

814


What is define c?

792


What is the importance of c in your views?

837


Can we access the array using a pointer in c language?

841


given post order,in order construct the corresponding binary tree

2557


Is null always defined as 0(zero)?

844


What are the different types of constants?

866