Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define N 2
struct country {
char c_name[30];
int population;
char capital[30];
};
/*
*
*/
int main(int argc, char** argv) {
struct country xwra[N];
int max = 0;
int i;
for (i=0; i<N; i++){
printf("\nGive country name.\t");
scanf("%s", xwra[i].c_name);
printf("\nGive the population.\t");
scanf("%d", &xwra[i].population);
printf("\nGive the capital.\t");
scanf("%s", xwra[i].capital);
if (xwra[i].population > max)
max = xwra[i].population;
}
return (EXIT_SUCCESS);
}
So how to printf the max population with name of the country and the capital???