- 2067 Asar · 2 marks
Syntax of struct
Short answer
Syntax: struct tag_name { data_type member1; data_type member2; ... }; then declare variables as struct tag_name var; Example: struct student { char name[20]; int roll; }; struct student s1;
Write the syntax used in C programming language for struct.
struct tag_name {
data_type member1;
data_type member2;
...
}; /* semicolon is compulsory */
struct tag_name variable; /* declaring a variable */
Example:
struct student {
char name[20];
int roll;
};
struct student s1;
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- Define programming language · Computer Programming, chapter 1 · asked 3×
- Syntax of while loop · Computer Programming, chapter 5
- Syntax of if...else · Computer Programming, chapter 5
- Syntax of static · Computer Programming, chapter 6
- Formatted I/O in FORTRAN with syntax · Computer Programming, chapter 11
- I/O functions used with data files · Computer Programming, chapter 10 · asked 2×
- 8086 assembly language operators · Microprocessor, chapter 3 · asked 3×
- Syntax of operator overloading · Object Oriented Programming, chapter 5 · asked 4×
- Class and function template with syntax · Object Oriented Programming, chapter 9 · asked 4×
- Default arguments and their syntax · Object Oriented Programming, chapter 3 · asked 2×