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
GeeksforGeeks has prepared a complete interview preparation course with premium videos, theory, practice problems, TA support and many more features. Please refer Placement 100 for details
- Program to Reverse a String using Pointers
- std::string::compare() in C++
- The length of a string using pointers
- Check if a string is palindrome in C using pointers
- Program to reverse an array using pointers
- C++ program to compare two Strings using Operator Overloading
- Program to implement Separate Chaining in C++ STL without the use of pointers
- Two Pointers Technique
- Applications of Pointers in C/C++
- Features and Use of Pointers in C/C++
- Pointers and References in C++
- Compare two Version numbers
- Compare two strings considering only alphanumeric characters
- How compare() method works in Java
- Compare two strings lexicographically in Java
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. 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.