C# Corner
Tech
News
Videos
Forums
Trainings
Books
Events
More
Interviews
Jobs
Live
Learn
Career
Members
Blogs
Challenges
Certifications
Bounties
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Access in Members With Pointer in C#
WhatsApp
Rajan Singh
Jun 28
2015
912
0
0
using
System.IO;
using
System;
public
struct
Coordinate {
public
int
x, y;
}
class
UsingPointers {
unsafe
public
static
void
UsingArrowOperator() {
Coordinate pixel =
new
Coordinate();
Coordinate * pixelPtr = & (pixel);
( * pixelPtr).x = 134;
( * pixelPtr).y = 34;
Console.WriteLine(
"Pixel Position: {0},{1}"
, pixelPtr - > x, pixelPtr - > y);
}
public
static
void
Main() {
unsafe
{
UsingArrowOperator();
}
}
}
Output
Pixel Position: 134,34
Pointer
ArrowOperator
C#