Free programming examples and instructions

C program to study structure

c program to study structure

by Krishna viswambharan

Posted on 17 Oct 2017 Category: C Views: 114

Edited on 12 Apr 2018

C program to study structure

In this article, we will learn about structures in C language.   We know that array in ‘c’ can hold several data items of same kind or type, in the same way,  structure is another user-defined data type available in C that allows to combine data items of different kinds.

Syntax of structure

struct structure_name 
    data_type member1;
    data_type member2;
    data_type memeberN;

This declaration above creates the derived data type struct person. To access any member of a structure, we use the  access operator (.).The following C program example shows how to use a structure in a  C program .

#include <stdio.h>
#include <conio.h>
#include <string.h>
struct student
char name[50];
int regno;
int sem;
void main()
   struct student s1;
   printf(“Enter student name :”);
   printf(“Enter student register no :”);
   printf(“Enter Semester :”);
   printf(“\n\t STUDENT DATA”);
   printf(“\nName :%s RegisterNo:%d Semester:%d”,s1.name,s1.regno,s1.sem);


Leave a Comment: