[Solved] Convert array of characters to array of ints c++? [closed]


You cannot just change the type of an array. If the first array is a char array, you need to create a new array that would hold integers. Then index by index you need to convert the character from the first array to an integer and then store it in your new array.

 int intArray[10];
 char charArray[10]; 
 for (int i = 0; i < 10; i++){
     intArray[i] = charArray[i] - '0';
  }

1

solved Convert array of characters to array of ints c++? [closed]