C Program
C Program
#include <stdio.h>
struct student {
char name[50];
int age;
};
void display(struct student s); // function prototype
int main() {
struct student s1;
printf("Enter name: ");
// read string input from the user until \n is entered
// \n is discarded
scanf("%[\n]%*c", s1.name);
printf("Enter age: ");
scanf("%d", &s1.age);
display(s1); // passing struct as an argument
return 0;
}
void display(struct student s) {
printf("\nDisplaying information\n");
printf("Name: %s", s.name);
printf("\nAge: %d", s.age);}
Compute the number of days an employee came late to the office by
considering his arrival time for 30 days (Use array of structures and
functions)
include <stdio.h>
/*structure declaration*/
struct employee{
char name[30];
};