By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,898 Members | 2,012 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,898 IT Pros & Developers. It's quick & easy.

help needed here

P: 18
hello..can anybody help me..
i cant understood the meaning of *(int *)p=2;
so pls hepl me...wt it actully do....
Sep 25 '06 #1
Share this Question
Share on Google+
4 Replies

P: 18
pls explain....*(int *)p=2;
Sep 25 '06 #2

P: 62
It means typecasting the variable to (int*) and assigning the value to pointer P
Sep 25 '06 #3

P: 13,264
Here is a pointer tutorial
Sep 25 '06 #4

Expert Mod 5K+
P: 8,916
I have to assume p is a pointer or contains the value of a pointer


(int *)p

casts p to be a pointer to an integer

*(int *)p

dereferences the pointer that is (int *)p, i.e. accesses the memory location referenced by (int *)p

*(int *)p = 2;

Sets the value of the memory location pointed to by the pointer (int *)p to 2

oh and please don't double post
Sep 25 '06 #5

Post your reply

Sign in to post your reply or Sign up for a free account.