int *p=20;
if u print like dis printf("%d",p);
o\p:- 20; how is it possible?
plz give me the explanation.

Answer Posted / yogi

int *p=20;
This is like int *p;p=20;
printf("%d",p);It prints p properly as 20;
printf("%d",*p);It means deference the value at address 20,
which is invalid .

If we try to run,as address 20 is invalid and it tries to
fetch the value at address 20,signal 11 sent to that process
i.e it dumps core with segmentation fault

Is This Answer Correct ?    4 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is c variable?

540


a function gets called when the function name is followed by a a) semicolon (;) b) period(.) c) ! d) none of the above

853


Explain how can you tell whether two strings are the same?

573


How is = symbol different from == symbol in c programming?

600


Describe the steps to insert data into a singly linked list.

612






What is the purpose of void pointer?

586


What is the difference between printf and scanf in c?

734


What is formal argument?

633


Write the test cases for checking a variable having value in range -10.0 to +10.0?

1806


count = 0; for (i = 1;i < = 10; i++);count = count + i; Value of count after execution of the above statements will be a) 0 b) 11 c) 55 d) array

665


How would you obtain the current time and difference between two times?

717


Where are local variables stored in c?

560


Can a pointer point to null?

578


What is storage class?

641


Differentiate between static and dynamic modeling.

605