Want to become a Vibe Coder? Join Vibe Coding Training here
x
C# Corner
Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
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
896
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#
Up Next
Access in Members With Pointer in C#