C program store and display information of cricket player using structure

C program to store and display the name, runs scored and wickets taken by a cricket player using structure

This C program is to store and display information of cricket player using structure i.e. store and display the name, runs scored and wickets taken by a cricket player using structure.

Basically one should know how to write the syntax of a structure and the rest is just implementation of the programs done so far.

If you yet need a dry run of the program or any other query, then kindly leave a comment in the comment box or mail me, I would be more than happy to help you.

Program

#include<stdio.h>
struct cricketer
{
    int runs,wickets;
    char name[25];
}player[100];

void main()
{
    int i,n;
    printf("Enter the no of cricket players\n");
    scanf("%d",&n);
    printf("Enter player info as name , runs scored , wickets taken\n");
    for(i=0;i<n;i++)
    {
        scanf("%s %d %d",player[i].name,&player[i].runs,&player[i].wickets);
    }
    printf("\nNAME\t\tRUNS\t\tWICKETS\n");
    for(i=0;i<n;i++)
    {
        printf("%s\t\t%d\t\t%d\n",player[i].name,player[i].runs,player[i].wickets);
    }
}

Output

Share Me!