
c语言i––是什么
Here s1, s2 and s3 are student type variables. We can also declare structure variables while defining the structure. This is shown in below example.
struct student
{
char name[10];
int marks;
int roll_no;
}s1,s2,s3;Structure Initialization
In the above code a1 and a2 are the structure variables. Consider carefully I have stored name, price and pages one by one.
Tips while using Structure in C
- Generally people forget to write semi colon at the end of closing brace of structure. It may give some big errors in your program. So write semi colon every time at the end of structure definition.
- Usually people declare structure variables at the top of the program. While making some big programs, programmers prefer to make separate header file for structure declaration. They include them at the beginning of the program.
Here s1, s2 and s3 are student type variables. We can also declare structure variables while defining the structure. This is shown in below example.
struct student
{
char name[10];
int marks;
int roll_no;
}s1,s2,s3;Structure Initialization
In the above code a1 and a2 are the structure variables. Consider carefully I have stored name, price and pages one by one.
Tips while using Structure in C
- Generally people forget to write semi colon at the end of closing brace of structure. It may give some big errors in your program. So write semi colon every time at the end of structure definition.
- Usually people declare structure variables at the top of the program. While making some big programs, programmers prefer to make separate header file for structure declaration. They include them at the beginning of the program.
翻译自: https://www.thecrazyprogrammer.com/2015/02/structure-in-c-part-1.html
c语言i––是什么