S
Schwammkopf
Hi !
What i want to do in C++ is :
int a[] = new a[2];
a[0] = 0, a[1] = 0;
int* p = &a[0];
while (1) // any condition instead of 1
{
(*p)++;
if (p == &a[0])
p = &a[1];
else
p = &a[0];
}
How is this in C# possible ? I googled and found the unsafe / fixed
statements, but couldnt find
how to reassign the pointer to a new address.
C# :
unsafe {
fixed (int* p = &a[0]) {
while(1)
{
//how can i now reassign the p to another address ?
}
}
What i want to do in C++ is :
int a[] = new a[2];
a[0] = 0, a[1] = 0;
int* p = &a[0];
while (1) // any condition instead of 1
{
(*p)++;
if (p == &a[0])
p = &a[1];
else
p = &a[0];
}
How is this in C# possible ? I googled and found the unsafe / fixed
statements, but couldnt find
how to reassign the pointer to a new address.
C# :
unsafe {
fixed (int* p = &a[0]) {
while(1)
{
//how can i now reassign the p to another address ?
}
}