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

What's the right way to use errno?

615


Is c language still used?

533


What is the sizeof () operator?

614


What is a nested loop?

643


Explain why C language is procedural?

766






What is memory leak in c?

629


When is a null pointer used?

633


Differentiate between new and malloc(), delete and free() ?

663


What is the scope of static variable in c?

523


Why c is a mother language?

552


Explain two-dimensional array.

621


while initialization of array why we use a[][2] why not a[2][]...?

1857


in iso what are the common technological language?

1627


How can you tell whether two strings are the same?

821


What is the use of volatile?

602