--- /dev/null
+#include <stdio.h>
+
+int stringLength(const char* str) {
+ int result = 0;
+
+ while (str[result] != '\0') {
+ ++result;
+ }
+
+ return result;
+}
+
+void swap(char* v1, char* v2) {
+ char temp = *v1;
+ *v1 = *v2;
+ *v2 = temp;
+}
+
+void reverseString(char* str) {
+ int length = stringLength(str);
+ int halfLength = length / 2;
+
+ for (int charId = 0; charId < halfLength; ++charId) {
+ swap(&str[charId], &str[length - charId - 1]);
+ }
+}
+
+/** Perform a classical ROT13 permutation in-place */
+void rot13(char* str) {
+ int length = stringLength(str);
+
+ for (int charId = 0; charId < length; ++charId) {
+ char chrValue = str[charId];
+
+ if (chrValue >= 'a' && chrValue <= 'z') {
+ str[charId] =
+ (chrValue - 'a' // Translate chrValue from 'a'-'z' to 0-25
+ + 13) // Add 13
+ % 26 // Rotate in 0-25
+ + 'a'; // Translate the value from 0-25 to 'a'-'z'
+ } else if (chrValue >= 'A' && chrValue <= 'Z') {
+ str[charId] = (chrValue - 'A' + 13) % 26 + 'A';
+ }
+ }
+}
+
+int main() {
+ char msg[] = "Votre message";
+ printf("Initial value: \"%s\"\n", msg);
+ reverseString(msg);
+ printf("Reversed : \"%s\"\n", msg);
+ reverseString(msg); // Restore the original message
+ rot13(msg);
+ printf("ROT13 : \"%s\"\n", msg);
+}