This is supossed 2 ask a user to enter 4 numbers and accept them as strings. Then it uses error checking using the isdigit lib. function, if the string contains chars, it asks for input again. Then it uses the atoi() to convert strings to integers. Then i still need it to add and print a total. I cant understand how to do all of that.Code:#include <stdio.h> #include <stdlib.h> #include <ctype.h> #define SIZE 4 int main() { char a[SIZE]; char *ptrA=a; int c[SIZE]; int count; int varify=1; while(varify==1) { //get nums printf("Enter Number for Array\n"); for(count=0;count<SIZE;count++) { scanf("%d",&a[count]); } for(count=0;count<SIZE;count++) { c[count]=atoi(ptrA); } for(count=0;count<SIZE;count++) { if(isdigit(c[count])==1) { printf("Must A Numeric Value"); varify=1; } else { varify=0; } } } //printing printf("Array reads:\n"); for(count=0;count<SIZE;count++) { printf("[%d]: %d\n",a[SIZE],a[count]); } }
THANX if you can help!