Code:
#include <stdio.h>
#include <string.h>

#define MAX_LEN 80

void reverse_string(char str[])
{
	int i, len = strlen(str);
	for(i = 0; i < (len / 2); i++)
	{
		char ch = str[i];
		str[i] = str[(len - 1) - i];
		str[(len - 1) - i] = ch;
	}
}

int main()
{
	char str[MAX_LEN+1];

	printf("Enter string:\n");
	scanf("%s", str);

	reverse_string(str);

	printf("%s\n", str);

	return 0;
}
This is how you can reverse a string using a For loop. However, I don't understand this part:

Code:
for(i = 0; i < (len / 2); i++)
	{
		char ch = str[i];
		str[i] = str[(len - 1) - i];
		str[(len - 1) - i] = ch;
	}
Could someone please explain it to me so I can understand it? Thanks