Hi I want to swap the numbers in string form in specific way.
For example :
If i have 10325476
then it should return 01234567
whatever i had tried so far is i just swapped the the pair of two numbers in String.
EDIT
if i have 01AB3423
then Answer should be 10BA4332
Following is my current implementation which gives me desired output.
char temp1 = c1[0];
c1[0] = c1[1];
c1[1] = temp1;
char temp2=c1[2];
c1[2]=c1[3];
c1[3]=temp2;
char temp3=c1[4];
c1[4]=c1[5];
c1[5]=temp3;
char temp4=c1[6];
c1[6]=c1[7];
c1[7]=temp4;
I have done this for all 8 numbers but its a static way. And i know its not a correct way to do this.I want to do this dynamically as well.is there any other way to implement this?
Any idea and advice will be appreciated.