TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Access in Members With Pointer in C#
Rajan Singh
Jun 28
2015
Code
863
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
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#