Program:
#include<stdio.h>
#include<string.h>
int main()
{
int i;
char str1[40]="COMPUTER";
char str2[40]="computer";
/*length of string*/
printf("Length of the string %s : %d \n\n",str1,strlen(str1));
/*Compare two strings*/
i=strcmp(str1,str2);
if(i==0)
{
printf("Two Strings are equal\n\n");
}
else
{
printf("Two Strings are not equal\n\n");
}
/*Reverse string*/
printf("reverse of %s is ",str1);
strrev(str1);
printf(" = %s \n\n",str1);
/*Concate string*/
strrev(str1);
printf("concate of %s and %s is ",str1,str2);
strcat(str1,str2);
printf(" = %s \n",str1);
return 0;
}
#include<stdio.h>
#include<string.h>
int main()
{
int i;
char str1[40]="COMPUTER";
char str2[40]="computer";
/*length of string*/
printf("Length of the string %s : %d \n\n",str1,strlen(str1));
/*Compare two strings*/
i=strcmp(str1,str2);
if(i==0)
{
printf("Two Strings are equal\n\n");
}
else
{
printf("Two Strings are not equal\n\n");
}
/*Reverse string*/
printf("reverse of %s is ",str1);
strrev(str1);
printf(" = %s \n\n",str1);
/*Concate string*/
strrev(str1);
printf("concate of %s and %s is ",str1,str2);
strcat(str1,str2);
printf(" = %s \n",str1);
return 0;
}
Output:
No comments:
Post a Comment