Given two strings, compare the strings using pointers
Input: str1 = geeks, str2 = geeks Output: Both are equal Input: str1 = hello, str2 = hellu Output: Both are not equal As their length are same but characters are different
The idea is to dereference given pointers, compare values and advance both of them.
geeks geeks are Equal
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- C++ program to compare two Strings using Operator Overloading
- C program to Compare Two Strings without using strcmp() function
- Program to Reverse a String using Pointers
- Program to reverse an array using pointers
- The length of a string using pointers
- Check if a string is palindrome in C using pointers
- Compare two Version numbers
- Compare two strings lexicographically in Java
- Compare two strings considering only alphanumeric characters
- Two Pointers Technique
- Program to implement Separate Chaining in C++ STL without the use of pointers
- std::string::compare() in C++
- Compare Version Numbers with large inputs allowed
- How compare() method works in Java
- Java | ==, equals(), compareTo(), equalsIgnoreCase() and compare()
- Problem in comparing Floating point numbers and how to compare them correctly?
- Efficient ways to compare a variable with multiple values
- Introduction of Smart Pointers in C++ and It's Types
- Dangling, Void , Null and Wild Pointers
- Pointers in C and C++ | Set 1 (Introduction, Arithmetic and Array)
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.