Untitled

 avatar
unknown
plain_text
a year ago
747 B
5
Indexable
#include<stdio.h>
#include<stdlib.h>
struct Emn
{
    int eno;
    char ename[20];
    float esal;
};void main()
{
    struct Emp*ptr;
    ptr=(struct Emp*)malloc(size of (struct Emp));
    if(ptr==NULL)
    {
        printf("Memory allocation failed\n");
        } else
        {
            printf("Enter employee number:\n");
            scanf("%d",&ptr->eno);
            printf("Enter Employee name:\n");
            scanf("%s",ptr->ename);
            printf("Enter Employee salary:\n");
            scanf("%f",ptr->esal);
            printf("\n Employee Number = %d\n",ptr->eno);
            printf("\n Employee Name = %s\n",ptr->ename);
            printf("\n Employee Salary = %f\n",ptr->esal);


        }
}
Editor is loading...
Leave a Comment