1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
| char *alphabet_position(char *s) {
for (size_t i = 0; i < strlen(s); i++) {
switch(*s){
case 'a':
*s = 1 + '0';
printf("Value of p : %c\n", *s);
break;
case 'b':
*s = 2 + '0';
printf("Value of p : %c\n", *s);
break;
case 'c':
*s = 3 + '0';
printf("Value of p : %c\n", *s);
break;
case 'd':
*s = 4 + '0';
printf("Value of p : %c\n", *s);
break;
case 'e':
*s = 5 + '0';
printf("Value of p : %c\n", *s);
break;
case 'f':
*s = 6 + '0';
printf("Value of p : %c\n", *s);
break;
case 'g':
*s = 7 + '0';
printf("Value of p : %c\n", *s);
break;
case 'h':
*s = 8 + '0';
printf("Value of p : %c\n", *s);
break;
case 'i':
*s = 9 + '0';
printf("Value of p : %c\n", *s);
break;
case 'j':
*s = 10 + '0';
printf("Value of p : %c\n", *s);
break;
case 'k':
*s = 11 + '0';
printf("Value of p : %c\n", *s);
break;
case 'l':
*s = 12 + '0';
printf("Value of p : %c\n", *s);
break;
case 'm':
*s = 13 + '0';
printf("Value of p : %c\n", *s);
break;
case 'n':
*s = 14 + '0';
printf("Value of p : %c\n", *s);
break;
case 'o':
*s = 15 + '0';
printf("Value of p : %c\n", *s);
break;
case 'p':
*s = 16 + '0';
printf("Value of p : %c\n", *s);
break;
case 'q':
*s = 17 + '0';
printf("Value of p : %c\n", *s);
break;
case 'r':
*s = 18 + '0';
printf("Value of p : %c\n", *s);
break;
case 's':
*s = 19 + '0';
printf("Value of p : %c\n", *s);
break;
case 't':
*s = 20 + '0';
printf("Value of p : %c\n", *s);
break;
case 'u':
*s = 21 + '0';
printf("Value of p : %c\n", *s);
break;
case 'v':
*s = 22 + '0';
printf("Value of p : %c\n", *s);
break;
case 'w':
*s = 23 + '0';
printf("Value of p : %c\n", *s);
break;
case 'x':
*s = 24 + '0';
printf("Value of p : %c\n", *s);
break;
case 'y':
*s = 25 + '0';
printf("Value of p : %c\n", *s);
break;
case 'z':
*s = 26 + '0';
printf("Value of p : %c\n", *s);
break;
}
s = s + 1;
}
return s;
} |
Partager