E D R , A S I H C RSS

C99표준�추가�C언어�엄청좋�기능

�가지.
선언� 블�� 앞� 아니� 중간�� 선언 가능.
배열� ��으로 저렇게 할당하다니 -_-...
함수내�서 함수 선언 가능.

#include <stdio.h>

int main()
{
int n;
printf("Array Size? ");
scanf("%d", &n);
int x[n];

int i;
for (i = 0; i < n; i++) {
x[i] = i * 10;
printf("%d ", x[i]);
}

printf("\n");
return 0;
}


  • í�  ì�´ìƒ�하네 ã…¡.ã…¡;; gccì—�서는 ë�˜ê³ , VS.netì—�서는 ì—�러를;; 잘못 컴파ì�¼ 한건가? 혹시 VS.netì—�서는 안ë�˜ë‚˜ìš”? - eternalbleu
  • í��ì�Œ... Cì—�서 ë�™ì �할당ì�„ 하기 위해서는 new나 malloc ì •ë�„ì�˜ 키워드를 사용해야 하지 않나요?? 혹시.. 컴파ì�¼ 옵션ì�„ 달리해야 하는??;; - ì�´ìŠ¹í•œ
  • 알아본 ê²°ê³¼ C99ì—�서 ì§€ì›�ë�˜ëŠ” 것으로 표준ì�´ 맞으며, 단지 VSì�˜ 컴파ì�¼ëŸ¬ê°€ C99를 완전히 만족시키지 않기 때문ì�´ë�¼ê³ í•¨. gccë�„ 3.0 ì�´í›„버전부터 ì§€ì›�ë�œ 기능으로 variable-length array ì�´ë�¼ê³  부르는군요. (gcc는 C99발표ì�´ì „부터 extension ì�˜ 형태로 ì§€ì›�ì�„ 하기는 했다고 합니다.) - eternalbleu
    Open source development using C99
    The new variable-length array (VLA) feature is partially available. Simple VLAs will work. However, this is a pure coincidence; in fact, GNU C has its own variable-length array support. As a result, while simple code using variable-length arrays will work, a lot of code will run into the differences between the older GNU C support for VLAs and the C99 definition. Declare arrays whose length is a local variable, but don't try to go much further.


Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:22:40
Processing time 0.0069 sec