Is there a way I can reduce the number of lines of code with this switch statement? Could I use a for loop but without reassigning the ci value? Or is this the most optimized it will get in terms of assignment based on logical expression?
char ci, co;
while (fscanf(fp1, "%c", &ci) != EOF) {
switch(ci) {
case 97:
co = 33;
break;
case 98:
co = 34;
break;
case 99:
co = 35;
break;
case 100:
co = 36;
break;
case 101:
co = 37;
break;
case 102:
co = 38;
break;
case 103:
co = 39;
break;
case 104:
co = 40;
break;
case 105:
co = 41;
break;
case 106:
co = 42;
break;
case 107:
co = 43;
break;
case 108:
co = 44;
break;
case 109:
co = 45;
break;
case 110:
co = 46;
break;
case 111:
co = 47;
break;
case 112:
co = 48;
break;
case 113:
co = 49;
break;
case 114:
co = 50;
break;
case 115:
co = 51;
break;
case 116:
co = 52;
break;
case 117:
co = 53;
break;
case 118:
co = 54;
break;
case 119:
co = 55;
break;
case 120:
co = 56;
break;
case 121:
co = 57;
break;
case 122:
co = 58;
break;
case 48:
co = 59;
break;
case 49:
co = 60;
break;
case 50:
co = 61;
break;
case 51:
co = 62;
break;
case 52:
co = 63;
break;
case 53:
co = 64;
break;
case 54:
co = 65;
break;
case 55:
co = 66;
break;
case 56:
co = 67;
break;
case 57:
co = 68;
break;
case 32:
co = 69;
break;
case 10:
co = 70;
break;
case 13:
co = 71;
break;
default:
break;
}
fprintf(fp2, "%c", co);
}
reduce switch