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 |
main() { int i=400,j=300; printf("%d..%d"); }
Cluster head selection in Wireless Sensor Network using C programming language.
main() { int i=4,j=7; j = j || i++ && printf("YOU CAN"); printf("%d %d", i, j); }
Which one is taking more time and why ? :/home/amaresh/Testing# cat time.c //#include <stdio.h> #define EOF -1 int main() { register int c; while ((c = getchar()) != EOF) { putchar(c); } return 0; } ------------------- WIth stdio.h:- :/home/amaresh/Testing# time ./time_header hi hi hru? hru? real 0 m4.202s user 0 m0.000s sys 0 m0.004s ------------------ Witout stdio.h and with #define EOF -1 =================== /home/amaresh/Testing# time ./time_EOF hi hi hru? hru? real 0 m4.805s user 0 m0.004s sys 0 m0.004s -- From above two case , why 2nd case is taking more time ?
main() { char i=0; for(;i>=0;i++) ; printf("%d\n",i); }
Write a C program to print ‘Campus Force training’ without using even a single semicolon in the program.
func(a,b) int a,b; { return( a= (a==b) ); } main() { int process(),func(); printf("The value of process is %d !\n ",process(func,3,6)); } process(pf,val1,val2) int (*pf) (); int val1,val2; { return((*pf) (val1,val2)); }
A program that will create a movie seat reservation. The program will display the summary seats and its status. The user will be ask what seat no. to be reserved, then it will go back again to the summary to display the updated seat status. If the seat no. is already reserved then it will prompt an error message. And also if the input seat no is out of range then it will also prompt an error message. The program is continuously running. Termination of the program will depends on how the programmer will apply. Sample output: Movie Seats Reservation Summary of Seats: Seat 1: Available Seat 2: Available Seat 3: Available Seat 4: Available Seat 5: Available Enter seat no. (Press 0 to terminate Or the assigned seat capacity) : 1 Movie Seats Reservation Summary of Seats: Seat 1: Reserve Seat 2: Available Seat 3: Available Seat 4: Available Seat 5: Available Enter seat no. (Press 0 to terminate Or the assigned seat capacity) : 6 The Seat no. is out of range! Movie Seats Reservation Summary of Seats: Seat 1: Reserve Seat 2: Available Seat 3: Available Seat 4: Available Seat 5: Available Enter seat no. (Press 0 to terminate Or the assigned seat capacity) : 1 The Seat no. is already reserved! Movie Seats Reservation Summary of Seats: Seat 1: Reserve Seat 2: Available Seat 3: Available Seat 4: Available Seat 5: Available Enter seat no. (Press 0 to terminate Or the assigned seat capacity) : 0 GoodBye... Thank You!!!
Write a prog to accept a given string in any order and flash error if any of the character is different. For example : If abc is the input then abc, bca, cba, cab bac are acceptable, but aac or bcd are unacceptable.
Write a program that produces these three columns sequence nos. using loop statement Sequence nos. Squared Squared + 5 1 1 6 2 4 9 3 9 14 4 16 21 5 25 30
Write a program to receive an integer and find its octal equivalent?
Is the following code legal? typedef struct a aType; struct a { int x; aType *b; };