Get a pointer to the start of a string and display the contents of string via pointer
using System;
class MainClass {
unsafe public static void Main() {
string str = "this is a test";
fixed(char* p = str) {
for(int i=0; p[i] != 0; i++)
Console.Write(p[i]);
}
Console.WriteLine();
}
}
Output this is a test
|
HTML code for linking to this page:
Related in same category :
-
-
-
-
-
-
-
-
-
-
-
-
|