can size of array be determined at run time in c?

前端 未结 6 1999
日久生厌
日久生厌 2020-11-29 08:24

As I know, an array needs to have a specific size before compiling time in c.

I wonder why this code still works?

int s;
printf(\"enter the array si         


        
6条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-29 09:05

    This code is supported by C99 language specification. This code is also supported by GCC compiler in C89/90 mode as an extension.

    So, the answer to your question (why it "works") depends on how you are compiling it. In general case, this will not even compile by a C89/90 compiler.

提交回复
热议问题