逆序数组中的每一个元素
int my_strlen(char*str)
{
int count = 0;
while (*str != '\0')
{
count++;
str++;
}
return count;
}
void Reverse_array(char arr[])
{
int left = 0;
int right = my_strlen(arr) - 1;
int temp = 0;
while (left < right)
{
temp = arr[left];
arr[left] = arr[right];
arr[right] = temp;
left++;
right--;
}
}
int main()
{
char arr[] = "abcdef";
Reverse_array(arr);
printf("%s", arr);
return 0;
}