I want to convert a char array[] like:
char myarray[4] = {\'-\',\'1\',\'2\',\'3\'}; //where the - means it is negative
So it should be the
It's not what the question asks but I used @Rich Drummond 's answer for a char array read in from stdin which is null terminated.
char *buff;
size_t buff_size = 100;
int choice;
do{
buff = (char *)malloc(buff_size *sizeof(char));
getline(&buff, &buff_size, stdin);
choice = atoi(buff);
free(buff);
}while((choice<1)&&(choice>9));