100% prog to copy contents of one structure variable to another variable of same structure


#include <stdio.h>
#include<stdlib.h>
void main()
{
    struct employee
    {
        int service_years;
        char name[17];
        float salary; // after deducting tax
    }e,duplicate; //to store three dates
    printf("\n enter service years (integer), name (string without space) and salary (float):");
    scanf("%d%s%f",&e.service_years,e.name,&e.salary);
    duplicate=e;
    printf("\n");
    printf("\n\n service_years=%d \n name=%s \n salary=%f",duplicate.service_years,duplicate.name,duplicate.salary);
}     

తెరమీద 
enter service years (integer), name (string without space) and salary (float):4 vishNu 12324.50
service_years=4
 name=vishNu
 salary=12324.500000

కామెంట్‌లు

ఈ బ్లాగ్ నుండి ప్రసిద్ధ పోస్ట్‌లు

100% C prog to write content into a file and then read it back onto the console

Spic macay

శ్రీరస్తు.. రామలింగ 18-1-24 (సూరసాని వారి ఆహ్వానము)