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

write a program in c to merge two array

2 Answers  


given integer number,write a program that displays the number as follows: First line :all digits second line : all except the first digit . . . . Last line : the last digit

8 Answers  


main() { int i; clrscr(); for(i=0;i<5;i++) { printf("%d\n", 1L << i); } } a. 5, 4, 3, 2, 1 b. 0, 1, 2, 3, 4 c. 0, 1, 2, 4, 8 d. 1, 2, 4, 8, 16

4 Answers   HCL,


What is the hidden bug with the following statement? assert(val++ != 0);

1 Answers  


write a program for area of circumference of shapes

0 Answers  






void main() { int i=5; printf("%d",i++ + ++i); }

3 Answers  


main( ) { int a[2][3][2] = {{{2,4},{7,8},{3,4}},{{2,2},{2,3},{3,4}}}; printf(“%u %u %u %d \n”,a,*a,**a,***a); printf(“%u %u %u %d \n”,a+1,*a+1,**a+1,***a+1); }

2 Answers  


Extend the sutherland-hodgman clipping algorithm to clip three-dimensional planes against a regular paralleiepiped

1 Answers   IBM,


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,


main() { int i, n; char *x = “girl”; n = strlen(x); *x = x[n]; for(i=0; i<n; ++i) { printf(“%s\n”,x); x++; } }

2 Answers  


Give a one-line C expression to test whether a number is a power of 2.

10 Answers   Microsoft,


Categories