I have test this code and result is correctly, but will got "567 S Pointer arithmetic is not on array." in line24 "arr++;", does anyone know how to fix it?
#include <iostream>
using namespace std;
int PartNum_Read(char* arr);
int PartNum_Read(char* arr)
{
uint32_t ret = 0U;
uint8_t ReadPartNumer[3]={'a','b','c'}; //copy from other function, type is uint8_t
if(arr != NULL)
{
for(int j = 0U; j < sizeof(ReadPartNumer); j++)
{
*arr = static_cast<char>(ReadPartNumer[j]);
arr++;
}
ret = (sizeof(ReadPartNumer));
}
cout << "PN: " << *arr << endl;
return ret;
}
int main()
{
cout<<"Hello World\n";
char PartNumer[3]={0};
PartNum_Read(&PartNumer[0]);
for(int i = 0U; i < 3; i++)
{
cout << "PN: " << PartNumer[i] << endl;
}
return 0;
}