We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi all, Please could somebdy inform me how to extract a character from one string, I mean, MyString="12345"; I want, for example, obtain the third position of the string, "3". Im using Uv2 and 8051 base micro. Thanks in advance.
"mychar = *(MyString + 2);" Although equivalent, the MyString[2] notation is much clearer and simpler. This is just deliberate obfuscation!
In this helpful spirit, I'll also offer:
mychar = *(char*)((int*)myString + index >> 1);
#pragma ASM MOV DPTR, #mystring INC DPTR INC DPTR MOVX A, @DPTR #pragma ENDASM
Hmmm... another contender for The International Obfuscated C Code Contest: http://www.ioccc.org/