Untitled

mail@pastecode.io avatar
unknown
plain_text
25 days ago
747 B
1
Indexable
Never
#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);


        }
}
Leave a Comment