Search
 
SCRIPT & CODE EXAMPLE
 

CPP

how to compare two char* in c++

#include <string.h>
...
if (strcmp(firstSTR, secondSTR) == 0) {
    // strings are equal
    ...
} else {
    // strings are NOT equal
}
Comment

comparing characters of a string in c++

#include<stdio.h>
#include<string.h>
int main() {
   char str1[] = "Tom!";
   char str2[] = "Tom!";
   int result = strcmp(str1, str2);
   if (result==0)
   printf("Strings are equal");
   else
   printf("Strings are unequal");
   printf("
Value returned by strcmp() is: %d" , result);
   return 0;
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: convert characters to lowercase c++ 
Cpp :: c include 
Cpp :: cpp class constructor 
Cpp :: notepad++ 
Cpp :: how to initialize vector 
Cpp :: copying a set to vector in c++ 
Cpp :: automatic legend matlab 
Cpp :: operand-- c++ 
Cpp :: convert kelvin to Fahrenheit 
Cpp :: how to delete an element in vector pair in cpp 
Cpp :: reversing a string in c++ 
Cpp :: cpp vector 
Cpp :: linked list in c++ 
Cpp :: size() in c++ SET 
Cpp :: 31. Next Permutation leetcode solution in c++ 
Cpp :: string format decimal places c++ 
Cpp :: how to make a square root function in c++ without stl 
Cpp :: system cpp 
Cpp :: why do we use pointers in c++ 
Cpp :: how to declare a vector of int in c++ 
Cpp :: print hola mundo 
Cpp :: C++ program for Celsius to Fahrenheit and Fahrenheit to Celsius conversion using class 
Cpp :: array copx c++ 
Cpp :: what library is rand in c++ 
Cpp :: how to print items in c++ 
Cpp :: Ninja c++ 
Cpp :: c++ catch Unhandled exception 
Cpp :: ifstream 
Cpp :: C++, binary search recursive 
Cpp :: C++ Taking Multiple Inputs 
ADD CONTENT
Topic
Content
Source link
Name
5+3 =