I have written code to reverse string. I am stuck with my logic. I know string is null terminated in c language so array hold total 6 character including NULL terminator
Program outputCode:#include <stdio.h>
int main()
{
int i = 0;
char array[6]= {"NEERG"};
char temp = array[0];
for ( int i = 0; i < 5; i++)
{
for (int j = 6; j >= 0; j--)
{
temp = array[i];
array[i] = array[j];
array[j] = temp;
}
}
printf("%s", array);
return 0;
}
all the letters are getting reverse but G is missing in stringCode:REEN
How to reverse all letters