C Program to store and display student information using structure | struct keyword in c #shorts #c

preview_player
Показать описание
🤗 Hello Friends,

Welcome to MC Coder! 🎉🎊

Steps of this program:

1. Include the necessary header file for standard input-output operations.

2. Define a structure named 'student' to store information about a student.
- The structure contains three members: 'name' (character array), 'roll' (integer), and 'marks' (float).

3. Define the main function:
- Declare a variable 's' of type 'student' to store the information of a student.

4. Prompt the user to enter information about the student:
- Print a message to instruct the user to enter the information.
- Use fgets() to read the name of the student, as it can handle input with spaces.

5. Read the roll number and marks of the student using scanf().

6. Display the information of the student:
- Print a message to indicate that the information is being displayed.
- Print the name, roll number, and marks of the student using printf().

7. Return 0 to indicate successful execution of the program.

Explanation of this program:

- This program stores and displays information about a student using a structure.
- The main function declares a variable 's' of type 'student' to store the information of a student.
- The user is prompted to enter the name, roll number, and marks of the student.
- The name is read using fgets() to handle input with spaces, while the roll number and marks are read using scanf().
- After reading the information, the program displays the entered information using printf().

Join our Telegram channel to download source code (programs) for free:

Please like, share, and subscribe/follow MC Coder for more programming videos. Your support inspires me to make more videos in a simple way to help you understand. So please subscribe/follow MC Coder and become a member of MC Coder's family.

Thank You! 🙏😊

Kind Regards,
MC Coder.
🥰🤗

#structure #structkeyword #mccoder #cprogramming #clanguage #coding #programming
Рекомендации по теме
welcome to shbcf.ru