#include <stdio.
h>
#include <string.h>
int main() {
char str[] = "Hello World";
printf("The length of the string is: %zu\n", strlen(str));
return 0;
}
#include <stdio.h>
#include <string.h>
int main() {
char src[] = "Hello World";
char dest[20];
strcpy(dest, src);
printf("The copied string is: %s\n", dest);
return 0;
}
#include <stdio.h>
#include <string.h>
int main() {
char str1[] = "Hello";
char str2[] = "World";
strcat(str1, str2);
printf("The concatenated string is: %s\n", str1);
return 0;
}
#include <stdio.h>
#include <string.h>
int main() {
char str1[] = "Hello";
char str2[] = "World";
int result = strcmp(str1, str2);
if(result == 0) {
printf("The strings are equal.\n");
}
else if(result < 0) {
printf("The first string is less than the second string.\n");
}
else {
printf("The first string is greater than the second string.\n");
}
return 0;
}
#include <stdio.h>
#include <string.h>
int main() {
char str[] = "Hello, World!";
printf("Original string: %s\n", str);
// Convert string to uppercase
strupr(str);
printf("Uppercase string: %s\n", str);
return 0;
}
#include <stdio.h>
#include <string.h>
int main() {
char str[] = "Hello, World!";
printf("Original string: %s\n", str);
// Convert string to lowercase
strlwr(str);
printf("Lowercase string: %s\n", str);
return 0;
}
#include <stdio.h>
#include <string.h>
int main()
{
char str[40]; // declare the size of character string
printf(" \n Enter a string to be reversed: ");
scanf("%s", str);
// use strrev() function to reverse a string
printf(" \n After the reverse of a string: %s ", strrev(str));
return 0;
}