STRING IN C.
#include <stdio.h>
#include <string.h>
int main()
{
char string1[] = "Aatifa";
char string2[] = "Mugheer";
char string3[67];
printf("The length of s1 is %d\n", strlen(string1));
printf("The length of s2 is %d\n", strlen(string2));
printf("The reversed string s1 is: ");
puts(strrev(string1));
printf("The reversed string s2 is: ");
puts(strrev(string2));
strcpy(string3, strcat(string1, string2));
puts(string3);
printf("The strcmp for string1, string2 returned %d", strcmp(string1,string2));
return 0;
}
OUTPUT:
The length of s1 is 6
The length of s2 is 7
The reversed string s1 is: afitaA
The reversed string s2 is: reehguM
afitaAreehguM
The strcmp for string1, string2 returned -1
Tysm
ReplyDeleteWoww
ReplyDelete