I program small devices, which communicate with each other and I need to label every action (and there are a lot) with an unique ID. Because of the architecture I can't use anything bigger than int (4 byte). So I had the idea to store the ID as a char array which I increment every time I call a certain function in a scenario like this:
void increaseIDByOne(char *ID){
//increase "string"
}
int main (int argc, char *argv[]){
char ID [12] = "00000000000";
while(true){
doStuff(&ID);
increaseIDByOne(&ID);
}
}
The problem I have is, that I don't know how to manipulate the "string" without casting it temporarily to a arithmetic type. After reaching the value "99999999999" as an ID, the system then should have a solution, by allocating more space for the number or by using some other solution to prevent overflows or doubled IDs. I hope that you can provide me with the right ideas, so I can find a solution for my problem.