I had originally made this program to take 7 inputs 11 times, but then for the sake of simplicity, set it to 2.
#include<stdio.h>
#include<string.h>
struct Cricketers{
char Name[50];
int ranking;
int age;
char Country[30];
int Num_of_matches;
int Bating_avg;
int Bowling_avg;
};
int main() {
struct Cricketers arr[2];
int i;
for(i=0; i<2; i++) //For taking inputs 2 times
{
scanf("%s", arr[i].Name);
scanf("%d", arr[i].ranking);
scanf("%d", arr[i].age);
scanf("%s", arr[i].Country);
scanf("%d", arr[i].Num_of_matches);
scanf("%d", arr[i].Bating_avg);
scanf("%d", arr[i].Bowling_avg);
}
for(i=0; i<2; i++) //For displaying the output
{
printf("%s", arr[i].Name);
printf("%d", arr[i].ranking);
printf("%d", arr[i].age);
printf("%s", arr[i].Country);
printf("%d", arr[i].Num_of_matches);
printf("%d", arr[i].Bating_avg);
printf("%d", arr[i].Bowling_avg);
}
return 0;
}
There are no compilation errors but after taking just 2 inputs the first time, the program just finishes execution. The program is supposed to take 7 inputs, 2 times.
After the execution finishes, this message appears:
"Process exited after 21.89 seconds with return value 3221225477 Press any key to continue . . ."
Why the value "3221225477"?