am supposed to fill an array of structure with some info and retreive it ....
what is wrong with my code! plz help!
what is wrong with my code! plz help!
Code:
#include<stdio.h> typedef struct { char name[20]; double salary; int rank; }employee; void fill_array(employee); employee display(employee); void main() { employee arr[2], e; fill_array(arr[2]); e = display(e); while(1); } void fill_array(employee arr) { int i; for(i = 0; i<2; i++) { printf("name --> "); scanf("%s", arr[i].name); printf("salary --> "); scanf("%lf", arr[i].salary); printf("rank --> "); scanf("%d", arr[i].rank); } } employee display(employee e) { employee arr[2]; int i; for(i = 0; i<2; i++) { printf("\n\n\n\nname --> ", arr[i].name); printf("\nsalary --> ", arr[i].salary); printf("\nrank --> ", arr[i].rank); } return e; }
Comment