STR

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

#include<stdio.

h>

//define a structure for student information

struct student{

int roll_no;

char name[50];

char course[50];

int age;

char gender;

char contact[5];

};

int main(){

//declare a structure variable

struct student student1;

//initialize structures members

student1.roll_no=1;

strcpy(student1.name,"muskan");

strcpy(student1.course,"computer science");

student1.age=20;

student1.gender='f';

strcpy(student1.contact,"9327115489");

//display student information

printf("roll no: %d\n",student1.roll_no);

printf("name: %s\n",student1.name);

printf("course: %s\n",student1.course);

printf("age: %d\n",student1.age);

printf("gender: %c\n",student1.gender);

printf("contact: %s\n",student1.contact);

return 0;

You might also like