C和派生数据类型? [英] C and derived data types?

查看:33
本文介绍了C和派生数据类型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道 C 中的基本数据类型 - char、int、float 等.但是 C 语言中的派生数据类型究竟是什么?

I know the fundamental data types in C - char, int, float etc. But What exactly are derived data types in C language?

推荐答案

6.2.5.20 of 标准(嗯,草稿;万岁免费 :) 涵盖了派生类型:

6.2.5.20 of the standard (well, a draft; hooray free :) covers derived types:

20 可以从对象、函数和不完整的类型,如下:
-- 数组类型描述了一个连续分配的非空对象集特定的成员对象类型,称为元素类型.数组类型是由它们的元素类型和数组中的元素数量来表征.一个数组类型据说是从它的元素类型派生出来的,如果它的元素类型是T,则数组类型有时被称为 T 的数组.从构造数组类型元素类型称为数组类型派生.
-- 一个结构类型描述了一个按顺序分配的非空成员对象集(并且,在某些情况下,是一个不完整的数组),每个数组都有一个可选的指定的名称和可能不同的类型.
-- 联合类型描述了一组重叠的非空成员对象,每个成员对象它具有可选的指定名称和可能不同的类型.
-- 函数类型描述了具有指定返回类型的函数.函数类型是其特征在于其返回类型以及其参数的数量和类型.一种函数类型据说是从它的返回类型派生的,如果它的返回类型是 T ,则函数类型有时被称为函数返回T.建设一个返回类型的函数类型称为函数类型派生.
-- 指针类型可以派生自函数类型、对象类型或不完整的类型,称为引用类型.指针类型描述了一个对象,其值提供对被引用类型的实体的引用.派生自的指针类型引用类型 T 有时被称为 指向 T 的指针.建设一个来自引用类型的指针类型称为指针类型派生.

20 Any number of derived types can be constructed from the object, function, and incomplete types, as follows:
-- An array type describes a contiguously allocated nonempty set of objects with a particular member object type, called the element type. Array types are characterized by their element type and by the number of elements in the array. An array type is said to be derived from its element type, and if its element type is T, the array type is sometimes called array of T. The construction of an array type from an element type is called array type derivation.
-- A structure type describes a sequentially allocated nonempty set of member objects (and, in certain circumstances, an incomplete array), each of which has an optionally specified name and possibly distinct type.
-- A union type describes an overlapping nonempty set of member objects, each of which has an optionally specified name and possibly distinct type.
-- A function type describes a function with specified return type. A function type is characterized by its return type and the number and types of its parameters. A function type is said to be derived from its return type, and if its return type is T , the function type is sometimes called function returning T. The construction of a function type from a return type is called function type derivation.
-- A pointer type may be derived from a function type, an object type, or an incomplete type, called the referenced type. A pointer type describes an object whose value provides a reference to an entity of the referenced type. A pointer type derived from the referenced type T is sometimes called pointer to T. The construction of a pointer type from a referenced type is called pointer type derivation.

这些构造派生类型的方法可以递归应用.

These methods of constructing derived types can be applied recursively.

这篇关于C和派生数据类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆