Structure With Pointer Object




This is the sample Structure program with pointer object.

Syntax for the Structure

struct structure_name
{
   datatype variable_name1:
   datatype variable_name2;
   —————–
   —————–
   —————–
   datatype variable_name n;
} Pointer_object_name;

Sample Structure program for employee details

#include<stdio.h>
#include<conio.h>

struct employee 
{
   int emp_no;
   char emp_name[20];
}*e;

void main()
{
   clrscr();
   printf(“enter employee name”);
   scanf(“%s”,&e->emp_name);
   printf(“Enter employee number”);
   scanf(“%d”,&e->emp_no);
   printf(“DETAILS OF THE EMPLOYEE”);
   printf(“****************************”);
   printf(“Name of the employee is %s :”,e->emp_name);
   printf(“Number of the employee is %d :”,e->emp_no);
   getch();
}

hope this will help you. See you on Next Post Don’t forget To subscribe me if any query don’t get hesitate to ask us.
Advertisements

Tell us Your Suggestion

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s