Login or Sign Up
Logging in...
Remember me
Log in
Or
Sign Up
Forgot password or user name?
Log in with
Search in titles only
Search in C only
Search
Advanced Search
Forums
Product Launch
Updates
Today's Posts
Member List
Calendar
Home
Forum
Topic
C
help needed here
Collapse
X
Collapse
Posts
Latest Activity
Photos
Page
of
1
Filter
Time
All Time
Today
Last Week
Last Month
Show
All
Discussions only
Photos only
Videos only
Links only
Polls only
Events only
Filtered by:
Clear All
new posts
Previous
template
Next
dasarisrikar
New Member
Join Date:
Sep 2006
Posts:
18
#1
help needed here
Sep 25 '06, 09:38 AM
hello..can anybody help me..
i cant understood the meaning of *(int *)p=2;
so pls hepl me...wt it actully do....
dasarisrikar
New Member
Join Date:
Sep 2006
Posts:
18
#2
Sep 25 '06, 09:54 AM
help needed here
pls explain....*(in t *)p=2;
Comment
Post
Cancel
srikar
New Member
Join Date:
Sep 2006
Posts:
62
#3
Sep 25 '06, 09:57 AM
It means typecasting the variable to (int*) and assigning the value to pointer P
Comment
Post
Cancel
r035198x
MVP
Join Date:
Sep 2006
Posts:
13225
#4
Sep 25 '06, 10:11 AM
Here
is a pointer tutorial
Comment
Post
Cancel
Banfa
Recognized Expert
Expert
Join Date:
Feb 2006
Posts:
9067
#5
Sep 25 '06, 06:44 PM
I have to assume p is a pointer or contains the value of a pointer
so
(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
Comment
Post
Cancel
Previous
template
Next
Working...
Yes
No
OK
OK
Cancel
👍
👎
☕
Comment