If your Windows 11 taskbar is not showing, you can try several troubleshooting steps to resolve the issue. Here are some potential solutions you can try:
In C language, you can reverse a string using the following steps:
- Take the input string from the user.
- Find the length of the string using the
strlen()
function. - Swap the first character with the last character, the second character with the second-last character, and so on until the middle of the string is reached.
- Print the reversed string.
Here is an example program that reverses a string:
#include <stdio.h>
#include <string.h>
int main() {
char str[100], temp;
int i, j, len;
printf("Enter a string: ");
scanf("%s", str);
len = strlen(str);
for (i = 0, j = len - 1; i < j; i++, j--) {
temp = str[i];
str[i] = str[j];
str[j] = temp;
}
printf("Reversed string: %s", str);
return 0;
}
In this program, the input string is taken from the user using the scanf()
function. The length of the string is calculated using the strlen()
function. The for
loop swaps the characters at the beginning and end of the string and works its way towards the middle. The reversed string is printed using the printf()
function.
Comments
Post a Comment