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

Lists the benefits of c programming language?

821


How can I avoid the abort, retry, fail messages?

868


How can I delete a file?

835


Why & is used in scanf in c?

814


How a string is stored in c?

814


What is the use of ?

818


What is difference between class and structure?

839


Can you assign a different address to an array tag?

908


Write the program with at least two functions to solve the following problem. The members of the board of a small university are considering voting for a pay increase for their 10 faculty members. They are considering a pay increase of 8%. Write a program that will prompt for and accept the current salary for each of the faculty members, then calculate and display their individual pay increases. At the end of the program, print the total faculty payroll before and after the pay increase, and the total pay increase involved.

2881


Write a function that will take in a phone number and output all possible alphabetical combinations

817


Dont ansi function prototypes render lint obsolete?

820


How many loops are there in c?

823


Explain about block scope in c?

858


Can we change the value of static variable in c?

762


Is using exit() the same as using return?

932