[Solved] How to convert array of char into array of int?


You are trying too hard. Here’s how typecasting should look

void typecasting(unsigned char test[SIZE], int array[SIZE]) {
    for (int i = 0; i < SIZE; ++i)
        array[i] = test[i];
}

Your code might be suitable if you were converting from a C string, i.e. if your original test array was

char test[] = "34,201,190,154,8,194,2,6,114,88,45,76,123,87,25,23,...";

So I guess you could say you’re misunderstanding the nature of char (and unsigned char) in C++. They can represent character data as in char greeting[] = "hello"; or they can represent small integers as in char test[] = {1,2,3};.

2

solved How to convert array of char into array of int?