이를테면...
void func( int a ) void func( int a , int b ) 이런식으로 인수의 갯수는 다르지만 함수이름이 동일하게 구현할수 있는지 궁금합니다.
기본적으로 C 에서는 함수 오버로딩을 지원하지 않는걸로
알고 있습니다. 그럼 고운 하루되시길...
가변함수라고 해서 직접 만들어서 쓰는 방법이 있긴 있다고 들었어요.
함수를 선언할 때,
int fucCrazy(int a, ... ) { va_list ap; . . va_start(ap,n); . . va_end(ap); }
뭐 이 딴 식으로 해서 a에는 들어갈 수 있는 인자의 수를 넣고, ... 에는 매개변수 항목들을....
텍스트 포맷에 대한 자세한 정보
<code>
<blockcode>
<apache>
<applescript>
<autoconf>
<awk>
<bash>
<c>
<cpp>
<css>
<diff>
<drupal5>
<drupal6>
<gdb>
<html>
<html5>
<java>
<javascript>
<ldif>
<lua>
<make>
<mysql>
<perl>
<perl6>
<php>
<pgsql>
<proftpd>
<python>
<reg>
<spec>
<ruby>
<foo>
[foo]
Re: C에서 인수가 다르지만 동일한 이름의 두함수가 가능한가요
기본적으로 C 에서는 함수 오버로딩을 지원하지 않는걸로
알고 있습니다. 그럼 고운 하루되시길...
Re: C에서 인수가 다르지만 동일한 이름의 두함수가 가능한가요
가변함수라고 해서 직접 만들어서 쓰는 방법이 있긴 있다고 들었어요.
함수를 선언할 때,
int fucCrazy(int a, ... )
{
va_list ap;
.
.
va_start(ap,n);
.
.
va_end(ap);
}
뭐 이 딴 식으로 해서 a에는 들어갈 수 있는 인자의 수를 넣고, ... 에는
매개변수 항목들을....
댓글 달기