简体   繁体   中英

What is the default data structure in C?

我遇到了一个问题,我无法在任何地方找到问题的答案,谁能帮我知道“C 中的默认数据结构是什么?”

I just had a quick scan through the K&R (Kernighan and Ritchie - The C Programming Language) book in the chapter on structures and there is no mention of a 'default data structure'. I certainly never heard of a default data structure when I was doing 'C' programming but just checked in case I had forgotten something from long ago.

As a suggestion, could it be interpreted as a trick question where the answer is 'none' or 'not applicable'?

When only a storage class is given, the type is assumed to be int . These are all legal and declare an integer, so if anything can be said to be the "default" data structure, int is it.

static var1;

int func()
{
    auto var2;
    register var3;
 }

(Yeah, still a dumb question [in the sense that "default data structure" is not a well-defined concept or term of art, and even experts wouldn't necessarily know what is being asked].)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM