{
int i = 25789;
char *p;
..............
..............
printf("%d",*p); /* (*p) should give in printf*/
}

dont assign p=i ............apart from this how we can typecast this program so that we can get interger value tp pointer p.............please help me this

What are you trying to achieve by assigning a (char*) an (int), which is illegal by the way
Please be more clear.

"printf("%d", p );" should print the adress of variable which p points to which is an integer.

If you dont assign any adress to the pointer then that pointer is bad ptr. You cant expect to get a meaningful value without assigning .

"printf("%d", p );" should print the adress of variable which p points to which is an integer.

OP stated

printf("%d",[B]*p[/B]);

which should attempt to print the value at p. Though your post is correct but the OP isn't clear of what he desires. Plus he is double posting...or threading if I must put it.

{
int i = 25789;
char *p;
..............
..............
printf("%d",*p); /* (*p) should give in printf*/
}

dont assign p=i ............apart from this how we can typecast this program so that we can get interger value tp pointer p.............please help me this

This might work:

int i = 25789;
char *p = (char *)&i;

printf("%d\n", *(int*)p);
// The above is the same as this:
printf("%d\n", i);

If you want to show the address store in p instead of the integer then use %p, not %d printf("%p\n", p);

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.