Here is a neat trick for checking whether two strings are equal



Here is a neat trick for checking whether two strings are equal..

Answer / Sidharth Sharma

You can use the 'strcmp()' function to compare two strings. However, if you want a shorter version for comparisons only (and not string manipulation), you can define your own macro:n`#define STR_EQ(a, b) (!(a)[0] && !(b)[0] || !(a)[0] == !(b)[0] && strcmp(a, b) == 0)n"`

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Interview Questions

2)#include<iostream.h> main() { printf("Hello World"); } the program prints Hello World without changing main() the o/p should be intialisation Hello World Desruct the changes should be a)iostream operator<<(iostream os, char*s) os<<'intialisation'<<(Hello World)<<Destruct b) c) d)none of the above

4 Answers   Siemens,


Can we declare a function inside a function in c?

1 Answers  


How can I direct output to the printer?

1 Answers  


what is difference between ANSI structure and C99 Structure?

1 Answers   Wipro,


Write a program that an operator and two operands read from input operand operator on the implementation and results display.

0 Answers  


in multiple branching construct "default" case is a) optional b) compulsarily c) it is not include in this construct d) none of the above

1 Answers  


what does keyword ‘extern’ mean in a function declaration?

1 Answers   Emerson,


program that accepts amount in figures and print that in words

2 Answers   Infosys, Lovely Professional University, Wipro,


what is the output of the code and how? main() { int *ptr,x; x=sizeof(ptr); printf("%d",x); }

1 Answers  


Input is "rama loves rajesh and rajesh Loves rama also and rajesh wear gloves and bloves" To print output is count the numbers of times repeted the word love without case sensitive.

1 Answers  


What is the difference between variable declaration and variable definition in c?

1 Answers  


#include <stdio.h> int main ( int argc, char* argv [ ] ) { int value1 = 10; int value2 = 5; printf ( "\n The sum is :%d", value1 | value2 ); } This is the answer asked by some one to add two numbers with out using arithmetic operator?Yes this answer is write it given out put as 15.But how????? what is need of following line? int main ( int argc, char* argv [ ] ) how it work?what is the meaning for this line? please explain me.Advance thanks

9 Answers   Excel,


Categories