일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
Tags
- ngui
- sql
- mysql
- pi
- python
- ubuntu
- Eclipse
- conda
- DROP
- awk
- SSH
- autovacuum
- Shader
- 쉘
- if
- c++11
- FIND
- Unity
- dataframe
- 배열
- List
- pandas
- null
- with
- sqlite
- expect
- C++
- SVN
- postgresql
- boost
Archives
- Today
- Total
その先にあるもの…
unsafe 본문
class MainClass
{
public static void Main (string[] args)
{
int nValue = 5;
int *pInt; pInt = &nValue;
Console.WriteLine ("Hello World!");
Console.WriteLine ( *pInt );
}
}
간단한 테스트 코드다.
포인터를 사용할려면 오류가 나온다.
블럭으로 지정해서 사용 가능하다.
class MainClass
{
public static void Main (string[] args)
{
unsafe
{
int nValue = 5;
int *pInt;
pInt = &nValue;
Console.WriteLine ("Hello World!");
Console.WriteLine ( *pInt );
}
}
}
unsafe를 적용하였지만 여전히 오류가 발생한다.
project name -> right click -> options -> Build(General) -> Allow 'unsafe' code check
'프로그래밍 > C#' 카테고리의 다른 글
WeakReference (0) | 2014.06.03 |
---|---|
CreateInstance, InvokeMember (0) | 2014.04.21 |
C#> struct -> string (0) | 2013.10.31 |
C# delegate (0) | 2013.09.10 |
C# const / readonly (0) | 2013.09.02 |
Comments