#include <stdio.h> int main() { //Declaration struct student{ // string muss be terminated by ['\0'] char name[20]; int roll; int age; }; //create struct variable struct student s1 = {"Bob", 3, 15}; //or you can also do struct student s2; printf("Enter your name\n"); scanf("%s",s2.name); printf("Enter your roll\n"); scanf("%d",&s2.roll); printf("Enter your age\n"); scanf("%d",&s2.age); //Accessing struct variable printf("Name: %s\n",s1.name); return 0; } // example taken from youtube channel We the computer guys