Reinitialize array in function
inside called function want reassign char array, compiler complains
"expected primary-expression before ']' token".
essentially code looks this
static char char_array[]="aaaa";
//change entries of char_array
if (some condition) char_array[] = "aaaa"; //reset char_array here error occurs.
of course 1 iterate on each character in array, isn't there better way?
"expected primary-expression before ']' token".
essentially code looks this
static char char_array[]="aaaa";
//change entries of char_array
if (some condition) char_array[] = "aaaa"; //reset char_array here error occurs.
of course 1 iterate on each character in array, isn't there better way?
there number of ways reset defined array. work:
edit: bad, ray.
code: [select]
if (some condition) {
memcpy(char_array, "aaaa", sizeof(char_array));
}
edit: bad, ray.
Arduino Forum > Using Arduino > Programming Questions > Reinitialize array in function
arduino
Comments
Post a Comment