Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Roof Top Pew Wee

Playing with Pointers in C#.

This topic is 5421 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

So I''m trying out the pointers in C# and I am having some trouble. To simplify what I am trying to do:

public unsafe class MyClass
{
     float* myFloatPtr;

     public setFloat(ref setTo)
     {
         // first I tried this

         // myFloatPtr= &setTo;

         // but then read that I have to have it fixed so I tried

         fixed(myFloatPtr = &setTo);
     }
}
With the fixed part, my error says "Identifier expected" and underlines the = sign. In all of the examples I saw, the fixed was the beginning of some brackets where they use the pointer in the function, and the pointer falls out of scope. How do I make it so that the pointer can be a member of the class? --Vic--

Share this post


Link to post
Share on other sites
Advertisement
Read this stuff;
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dncscol/html/csharp10182001.asp

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!