What is the difference between an Array Data Structure and an Array Data-type in the context of a programming language like C?

后端 未结 4 1545
我在风中等你
我在风中等你 2020-12-29 16:03

Wikipedia differentiates an Array Data Structure and an Array Data-type.

What is the difference between an Array Data Structure and an Array Data-type in the context

4条回答
  •  旧巷少年郎
    2020-12-29 16:44

    Brackets [] is how you designate an Array Data Type in C

    Similary, * is how you designate a Pointer Data Type in C

    int array[]={1, 2, 3, 4, 5}; is an example of an Array Data Structure in C

    Specifically, you have defined a data structure which has 5 integers arranged contiguously, you have allocated sufficient memory on the stack for that data structure, and you have initialized that data structure with values 1, 2, 3, 4, 5.

    A Data Structure in C has a non-zero size which can be found by calling sizeof() on an instance of that structure.

提交回复
热议问题