I've found this code in a student program, which was converting digits from a string into their corresponding values:
int temp2 = s[i];
int temp = strtol(&temp2, NULL, 10);
It's definitely not a good example of C programming and I've already listed many better alternatives.
The question is if, assuming a little endian architecture, this is guaranteed to always work or not. I'm inclined to say that this type punning (int -> char*) (int -> char) is UB, but is there any other case in which this would fail, excluding big endian CPUs?