This is the easy and fast way if you have this case:
int concated;
char ABC[4] = ""; // char[] Initializing
int a = 1, b = 4, c = 2;
ABC<-sprintf(ABC, "%d%d%d", a, b, c); // No space between %d%d%d
printf("%s", ABC); // Value as char[] = 142
concated = atoi(ABC); // Result is 142 as int, not 1, 4, 2 (separated)
// Now use switch case on 142 as an integer and all possible cases
Explanation:
For example, if I have many menus, each choice on the 1st menu takes you to the 2nd menu, the 2nd to the 3rd menu, and so on. But the Options are different.
You know that the user has chorused finally. Example:
Menu 1: 1 -> Menu 2: 4 -> Menu 3: 2
The choice is 142. Other cases: 111, 141, 131, 122 ...
Solution:
Store the first 1st in A, 2nd in B, 3rd in C.
char ABC[4] = "";
ABC<-sprintf(ABC, "%d%d%d", a, b, c); // Without space between %d%d%d
printf("%s", ABC); // Value as char[] = 142
// Now you want to recover your value (142) from char[] to int as int value 142
concated = atoi(ABC);