Untitled
unknown
plain_text
2 years ago
646 B
9
Indexable
/*
#include<stdio.h>
#include<stdlib.h>
struct Emp {
int eno;
char ename[20];
float esal;
};
void main() {
struct Emp *ptr;
ptr= (struct Emp*) malloc(sizeof(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=%.2f\n",ptr ->esal);
}
}Editor is loading...
Leave a Comment