I have got a function declared like this:
uint8_t* func()
{
uint8_t arr[8] = { 1,2,3,4,5,6,7,8 };
return arr;
}
But when I try to read this data from a function - casted to unsigned:
uint8_t* readedArray = func();
for (int i = 0; i < 8; i++)
{
cout << (unsigned int)readedArray[i] << endl;
}
I'm not getting as a result
1
2
3
4
5
6
7
8
but something like this:
1
16
131
0
136
153
222
12
Why is it caused?