Why do I sometimes see atoi used instead of scanf().
struct store{
int number;
};
int main()
{
struct store shop;
char age[10];
printf("input a number:>");
gets(age); /* ok. should be fgets */
shop.number=atoi(age); /* why this */
scanf("%d",&shop.number), /* instead of this */
}
/* also does atoi work like this */
/* scans the array age element by element 0=49, 1=50, 2=51 */
/* converts these ascii values into there digit equivalents 1,2,3 */
/* and add each one to shop.number */
thanks for all the guidence guys.