Using of typedef struct

 

#include<stdio.h>
#include<string.h>
typedef struct student{
    char  name[10];
    int sal;
} emp ;

int main(){
   emp sl;
   
    printf("enter the employee details");
    printf("\n");
    printf("enter the employee name");
    scanf("%[^\n]s",sl.name);
    printf("\n");
    printf("enter the employee salary");
    scanf("%d",&sl.sal);
    printf("\n");
    printf("employee details");
   
    printf("\n");
    printf("%s is employee name",sl.name);
    printf("\n");
    printf("%d is employee salry ",sl.sal);
   
   
    }



Comments

Popular posts from this blog

Snake game.c

Type declaration

Array with function