Can the “if” function be used in comparing strings?



Can the “if” function be used in comparing strings?..

Answer / Ajay Krishna

Yes, the 'if' statement can be used to compare strings by using the equality operator (==). For example: if(str1 == str2) {...} compares two strings for equality.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Interview Questions

Add Two Numbers Without Using the Addition Operator

1 Answers  


What should malloc() do? Return a null pointer or a pointer to 0 bytes?

1 Answers  


what is the code to display color fonts in the output?

1 Answers  


Explain heap and queue.

1 Answers   Aricent,


Can we increase size of array in c?

1 Answers  


What are valid signatures for the Main function?

1 Answers  


What Is The Difference Between Null And Void Pointer?

1 Answers   TCS,


1. What is the output of printf("%d") 2. What will happen if I say delete this 3. Difference between "C structure" and "C++ structure". 4. Diffrence between a "assignment operator" and a "copy constructor" 5. What is the difference between "overloading" and "overridding"? 6. Explain the need for "Virtual Destructor". 7. Can we have "Virtual Constructors"? 8. What are the different types of polymorphism? 9. What are Virtual Functions? How to implement virtual functions in "C" 10. What are the different types of Storage classes? 11. What is Namespace? 12. What are the types of STL containers?. 13. Difference between "vector" and "array"? 14. How to write a program such that it will delete itself after exectution? 15. Can we generate a C++ source code from the binary file? 16. What are inline functions? 17. Talk sometiming about profiling? 18. How many lines of code you have written for a single program? 19. What is "strstream" ? 20. How to write Multithreaded applications using C++? 21. Explain "passing by value", "passing by pointer" and "passing by reference" 22. Write any small program that will compile in "C" but not in "C++" 23. Have you heard of "mutable" keyword? 24. What is a "RTTI"? 25. Is there something that I can do in C and not in C++? 26. Why preincrement operator is faster than postincrement? 27. What is the difference between "calloc" and "malloc"? 28. What will happen if I allocate memory using "new" and free it using "free" or allocate sing "calloc" and free it using "delete"? 29. What is Memory Alignment? 30. Explain working of printf. 31. Difference between "printf" and "sprintf". 32. What is "map" in STL? 33. When shall I use Multiple Inheritance? 34. What are the techniques you use for debugging? 35. How to reduce a final size of executable? 36. Give 2 examples of a code optimization.

2 Answers  


program to find which character is occured more times in a string and how many times it has occured? for example in the sentence "i love india" the output should be i & 3.

3 Answers  


name the language for writing c compiler?

3 Answers   Microsoft,


write program on arrays

3 Answers   GE, Polycab,


What is string constants?

1 Answers  


Categories