Click here to Skip to main content
15,886,845 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
#include<stdio.h>
int main()
{
int a=10,*p=&a;
printf("%u\n%u\n%u\n%u\n",&p,&a,p,*p);
scanf("%d",p);
//scanf("%p",p);
printf("%d..%d\n%d\n%u\n",*p,p,a,&p);
}
~
~
Posted
Updated 21-Jan-15 7:08am
v2

1 solution

You are printing different things in the two different printf statements and you are the wrong format specifiers. It should be:
C
#include<stdio.h>
int main()
{
  int a=10,*p=&a;
  printf("%p\n%p\n%p\n%d\n",&p,&a,p,*p);
   if ( scanf("%d",p) != 1 ) return -1;
  //scanf("%p",p);
  printf("%d..%p\n%d\n%p\n",*p,p,a,&p);
  return 0;
}
 
Share this answer
 
v2
Comments
Member 11389221 21-Jan-15 17:19pm    
thanks for the answer ,but i need to ask if i use %d ,so according to u %d format specifier prints different value because this crosses th limit of the particular format specifier?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900