write the function. if all the character in string B appear in
string A, return true, otherwise return false.

Answers were Sorted based on User's Feedback



write the function. if all the character in string B appear in string A, return true, otherwise ret..

Answer / kathiresan

#include<stdio.h>
#include<string.h>

int main()
{
char *str1 = "Hello";
char *str2 = "Hello";

int len1,len2;
len1 = strlen(str1);
len2 = strlen(str2);
if(len1 != len2)
{
printf("\nBoth Strings are not matched");
return 0;
}

while(*str1)
{
if(*str1 == *str2)
{
*str1++;
*str2++;
}
else
{
printf("\nString Not Matched\n");
return 0;
}
}
printf("\nBoth String are EQual");
}

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More C Code Interview Questions

Cau u say the output....?

1 Answers  


main() { char a[4]="HELL"; printf("%s",a); }

3 Answers   Wipro,


#include<stdio.h> main() { struct xx { int x; struct yy { char s; struct xx *p; }; struct yy *q; }; }

1 Answers  


int i,j; for(i=0;i<=10;i++) { j+=5; assert(i<5); }

3 Answers   Cisco, HCL,


char inputString[100] = {0}; To get string input from the keyboard which one of the following is better? 1) gets(inputString) 2) fgets(inputString, sizeof(inputString), fp)

1 Answers  


Write a program that find and print how many odd numbers in a binary tree

1 Answers  


how to return a multiple value from a function?

5 Answers   Wipro,


{ int *ptr=(int*)malloc(sizeof(int)); *ptr=4; printf("%d",(*ptr)+++*ptr++); }

4 Answers  


#include<stdio.h> int main() { int x=2,y; y=++x*x++*++x; printf("%d",y); } Output for this program is 64. can you explain how this output is come??

1 Answers  


main() { int i=3; switch(i) { default:printf("zero"); case 1: printf("one"); break; case 2:printf("two"); break; case 3: printf("three"); break; } }

1 Answers  


#include<stdio.h> void fun(int); int main() { int a; a=3; fun(a); printf("\n"); return 0; } void fun(int i) { if(n>0) { fun(--n); printf("%d",n); fun(--n); } } the answer is 0 1 2 0..someone explain how the code is executed..?

1 Answers   Wipro,


How to access command-line arguments?

4 Answers  


Categories