what we write
-
Hi what we write in c# int a; int *p=&a;
-
Hi what we write in c# int a; int *p=&a;
You can use pointers in C#, but only in code blocks marked unsafe. Usually you use references. As an int is not a reference type, you have to box it as an object to get a reference to it:
int a = 42; object r = a;
To get the integer value back from the object, you cast it:int b = (int)r;
Note that boxing is much less efficient than working with the plain value types directly, as an object has to be created to contain the value.--- b { font-weight: normal; }
-
Hi what we write in c# int a; int *p=&a;
int a; int *p=&a Not sure. But think it is unsafe code, As I remember it worked in the old Bell Labs 'C'. Sorry, I just had to.. No hate here.. Just sort of 'funnin' ya!:-D
-
Hi what we write in c# int a; int *p=&a;
unsafe
{
int a;
int *p = &a;
}Compile with /unsafe
Tech, life, family, faith: Give me a visit. I'm currently blogging about: For Christians: The Significance of Yom Teruah The apostle Paul, modernly speaking: Epistles of Paul Judah Himango