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
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Chung Le Kha
NA
8
0
Expert to C# Help Me!
Nov 2 2009 1:30 PM
I am learning about the programming language C #. to the use of
unsafe code and pointers in C #
.
and this is all my code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
struct Location
{
public int X;
public int Y;
}
unsafe static void Main(string[] args)
{
Location loc;
loc.X = 100;
loc.Y = 100;
Location* loc_ptr;
loc_ptr = &loc;
Console.WriteLine("X = {0}", loc_ptr->X);
loc_ptr->X = 200;
Console.WriteLine("X = {0}", loc_ptr->X);
}
}
}
the code is in error as follows:
unsafe code may only appear if compiling
with/unsafe
// I tried and then move consoleapplication but it failed. and error is so
//Hope the experts help answer helped me
Reply
Answers (
8
)
Sum problem
BackgroundWorker Tools