#include <stdio.h>
#include <string.h>
typedef char String[80];
int main() {
String originalStr = "mail";
String reversedStr;
int index;
int len = strlen(originalStr);
for (index = 0; index < len; index++) {
reversedStr[index] = originalStr[len - index -1];
}
reversedStr[index] = '\0';
printf("Original is %s, reversed is %s\n", originalStr, reversedStr);
}
I am wondering how can I modify the main
function to use a void
function with the prototype: void reverseString(String originalStr, String reversedStr);
As a matter of fact, I cannot understand difference between void
and main
.