I'm trying to test the function below:
uint32_t atoi_len(uint8_t **buf, uint8_t len) {
uint32_t value = 0;
do {
if ((**buf < '0') || (**buf > '9')) return 0;
value *= 10;
value += *((*buf)++) - '0';
} while (--len);
return value;
}
I have redefined uint32_t and uint8_t as int and char, just to make it work on my pc (Codeblocks).
What I'm trying to do is define a 2 dimensional array and pass this to this function as first argument (uint8_t **), but nothing works.
uint8_t buffer[10][10] = {"test", "test2", "stuff", "something"};
but i can't call:
atoi(buffer, len);
not even:
atoi_len(&buffer[0][0], len);
atoi_len(&buffer[0], len);
How can be initialized and accessed by a pointer? How do I pass the pointer to the function?
How can I build a 2 dimensional array, and pass the pointer to this to the function? I'm able to do it in one dimension easily:
char array[30] = "testof the test";
char* str = array; //or char* str = &array[0];
I would like to have this simple method to create a multidimensional array and assign a pointer to it, so that I can access array by pointer and even pass this pointer to a function.
Thank you very much, S