How can I convert the char array x to an integer 89 in the code below? Thank you
int main(int argc,char *argv[]){
char y[13] = "0123456789012";
char x[3];
int integer_value;
x[0] = y[8];
x[1] = y[9];
x[3] = '\0';
integer_value=atoi(x);
}
x[2] = '\0';, rather thanx[3], but apart from that, that works. What is the question?x[2] = '\0';,x[3]is out of bounds.yis one too short as there is a null character in a string literal.