'typeof'에 해당되는 글 1건

  1. 2007/05/08 typeof 예제소스
typeof 의 활용에 대한 간략한 예제를 만들어 봤습니다.

관련글: http://www.joinc.co.kr/modules.php?op=modload&name=Forum&file=viewtopic&topic=31030&forum=1

코드:

/* By JaeHyuk Cho <mailto:minzkn@infoeq.com> */

#include <stdio.h>

int main(void)
{
int s_int;
char s_char;
long s_long;
typeof(s_long) s_c;

(void)fprintf(stdout, "%d\n", sizeof(typeof(s_int)));
(void)fprintf(stdout, "%d\n", sizeof(typeof(s_char)));
(void)fprintf(stdout, "%d\n", sizeof(typeof(s_long)));

s_c = (typeof(s_c))1234; /* 해당 대입될 변수로 자동으로 캐스팅 하는 ... */

(void)fprintf(stdout, "%d\n", (int)s_c);

return(0);
}

/* End of source */
크리에이티브 커먼즈 라이센스
Creative Commons License
Posted by minzkn

트랙백 주소 :: http://blog.minzkn.com/trackback/85

댓글을 달아 주세요