Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

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;
}
Source by www.tutorialspoint.com #
 
PREVIOUS NEXT
Tagged: #comparing #characters #string
ADD COMMENT
Topic
Name
6+1 =