C Program to print student details using a structure

In this program, You will learn how to print student details using structure in c.

struct struct_name { 

Example: How to print student details using structure in c.


struct Student {
    char roll[10];
    char name[100];
    char university[100];

int main() {

    char newline;
    struct Student st;

    printf("Enter your Roll:");
    scanf("%[^\n]%*c", st.roll); 

    printf("Enter Your Name : ");
    scanf("%[^\n]%*c", st.name); 

    printf("Enter University Name : ");
    scanf("%[^\n]%*c", st.university); 

    printf( "\n\nYour Roll is:%s", st.roll);
    printf( "\nYour Name is:%s", st.name);
    printf( "\nYour University is:%s", st.university);

    return 0;


Enter your Roll:101
Enter Your Name : Xiith.com
Enter University Name : Xiith34

Your Roll is:101
Your Name is:Xiith.com
Your University is:Xiith34

Xiith is created for educational, experimental, and schooling purpose. Examples on Xiith are made easier to make a better or basic understanding. Tutorials, testimonials, and examples are continuously checked to avoid delusion, but we cannot take complete responsibility of all programs on Xiith. When you are operating this site, you have to agree to read and accept our terms of use, cookie and privacy policy.Copyright © 2020 by Xiith. All Rights Reserved. About us.