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
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 |
Cau u say the output....?
main() { char a[4]="HELL"; printf("%s",a); }
#include<stdio.h> main() { struct xx { int x; struct yy { char s; struct xx *p; }; struct yy *q; }; }
int i,j; for(i=0;i<=10;i++) { j+=5; assert(i<5); }
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)
Write a program that find and print how many odd numbers in a binary tree
how to return a multiple value from a function?
{ int *ptr=(int*)malloc(sizeof(int)); *ptr=4; printf("%d",(*ptr)+++*ptr++); }
#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??
main() { int i=3; switch(i) { default:printf("zero"); case 1: printf("one"); break; case 2:printf("two"); break; case 3: printf("three"); break; } }
#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..?
How to access command-line arguments?