struct
「struct」の意味・「struct」とは
「struct」は、プログラミング言語CやC++において、複数の異なる型のデータを一つのグループとしてまとめるための構造体を表すキーワードである。これにより、異なる型のデータを一つの単位として扱うことが可能となる。例えば、学生の情報を管理する際に「名前」「学籍番号」「成績」など、異なる型のデータを一つの「学生」という構造体で管理することができる。「struct」の発音・読み方
「struct」の発音は、IPA表記では /strʌkt/ となる。IPAのカタカナ読みでは「ストラクト」となり、日本人が発音するカタカナ英語では「ストラクト」と読む。この単語は発音によって意味や品詞が変わる単語ではない。「struct」の定義を英語で解説
A 'struct' in the C and C++ programming languages is a keyword that denotes a structure, a composite data type that groups together variables of different types. For instance, when managing student information, different types of data such as 'name', 'student number', and 'grades' can be managed as a single 'student' structure.「struct」の類語
「struct」の類語としては、他のプログラミング言語における同様の概念を表す「class」や「record」がある。これらも同様に、複数の異なる型のデータを一つの単位として扱うことが可能である。「struct」に関連する用語・表現
「struct」に関連する用語としては、「union」や「enum」がある。これらもCやC++におけるデータ型を表すキーワードである。また、「struct」を用いて定義された構造体は、「インスタンス」を生成することが可能である。「struct」の例文
1. English example (Japanese translation): "In C programming, a 'struct' is used to group together different types of data." (C言語のプログラミングでは、「struct」は異なる型のデータをまとめるために使用される。)2. English example (Japanese translation): "The 'struct' keyword allows us to create a student structure with 'name', 'student number', and 'grades' as its members." (「struct」キーワードを使うことで、「名前」、「学籍番号」、「成績」をメンバーとする学生の構造体を作成することができる。)
3. English example (Japanese translation): "A 'struct' can also contain functions, known as methods." (「struct」はメソッドと呼ばれる関数も含むことができる。)
4. English example (Japanese translation): "The 'struct' keyword is also used in other programming languages such as C++ and C#." (「struct」キーワードは、C++やC#などの他のプログラミング言語でも使用される。)
5. English example (Japanese translation): "A 'struct' can be used to create complex data structures." (「struct」は複雑なデータ構造を作成するために使用することができる。)
6. English example (Japanese translation): "A 'struct' can be used to create a data type that can hold different types of data." (「struct」は、異なる型のデータを保持できるデータ型を作成するために使用することができる。)
7. English example (Japanese translation): "A 'struct' can be used to create a new data type that can hold a group of data." (「struct」は、一組のデータを保持できる新しいデータ型を作成するために使用することができる。)
8. English example (Japanese translation): "A 'struct' can be used to create a data structure that can hold a collection of data of different types." (「struct」は、異なる型のデータの集合を保持できるデータ構造を作成するために使用することができる。)
9. English example (Japanese translation): "A 'struct' can be used to create a data structure that can hold a set of data." (「struct」は、一組のデータを保持できるデータ構造を作成するために使用することができる。)
10. English example (Japanese translation): "A 'struct' can be used to create a data structure that can hold a group of related data." (「struct」は、関連する一組のデータを保持できるデータ構造を作成するために使用することができる。)
構造体
(Struct から転送)
出典: フリー百科事典『ウィキペディア(Wikipedia)』 (2022/11/02 18:42 UTC 版)
構造体(こうぞうたい、英: structure)はプログラミング言語におけるデータ型の一つで、1つもしくは複数の値をまとめて格納できる型。それぞれのメンバー(フィールド)に名前が付いている点、またメンバーの型が異なっていてもよい点が配列と異なる。レコードという名前の類似機能として実装されている言語もある。
注釈
- ^ データクラスのすべてのプロパティを
val
で宣言することで、イミュータブルにすることもできる。
出典
- ^ User-defined data type (VBA) | Microsoft Docs
- ^ レコード・クラス | Oracle Java SE 16 Help Center
- ^ Java 16の最新情報 | InfoQ
- ^ データクラス - Kotlin Programming Language
- ^ a b 構造体型 - C# リファレンス | Microsoft Docs
- ^ a b クラス - C# プログラミング ガイド | Microsoft Docs
- ^ a b Structure ステートメント - Visual Basic | Microsoft Docs
- ^ 構造体とクラス(Structures and Classes) · The Swift Programming Language日本語版
- ^ Structures and Classes — The Swift Programming Language (Swift 5.6)
- ^ OpenCL-Headers/cl.h at master · KhronosGroup/OpenCL-Headers
- ^ Vulkan-Headers/vulkan_core.h at master · KhronosGroup/Vulkan-Headers
- ^ Choosing Between Class and Struct - Framework Design Guidelines | Microsoft Docs
- ^ Parameterless struct constructors - C# 10.0 draft specifications | Microsoft Learn
- ^ Structures - F# | Microsoft Docs
- ^ ref class and ref struct (C++/CLI and C++/CX) | Microsoft Docs
- ^ StructLayoutAttribute Class (System.Runtime.InteropServices) | Microsoft Docs
- ^ Storage and Alignment of Structures | Microsoft Docs
- Structのページへのリンク