I'm a newbie to C and I'm trying to sort this program by account_num but the bubble sort just wont seem to work. Its say "int to int lacks a cast" What does this mean and what can i do to fix it.
Code:
#include <stdio.h>
main()
{
/*Variables*/
/*-------------------------------------------------------------------------------*/
struct info{char name[30]; int account_num[30]; float balance[30];
};
struct info people[25];
int x,a,temp;
/*------------------------------------------------------------------------------*/
/*Heading*/
/*-------------------------------------------------------------------------------*
//*Loop to collect info*/
for(x = 1; x <= 2; ++x)
{ printf("Enter Name: ");
scanf("%s",people[x].name);
printf("Enter Account Number: ");
scanf("%i",people[x].account_num);
printf("Enter Balance: ");
scanf("%f",&people[x].balance);
}
for (a=1; a<x-1;++a)
{ for (x=1; x<10;++x)
{
if (people[x].account_num>people[x+1].account_num)
{
temp = people[x+1].account_num;
people[x+1].account_num = people[x].account_num;
people[x].account_num = temp;
}/*end if*/
}/*end nested for*/
}/*end for loop*/
}
Thanks!