Search
 
SCRIPT & CODE EXAMPLE
 

C

strncmp function

Run1:
Enter String 1: Welcome
Enter String 2: TO my World
Welcome is greater than TO my World
Run 2:
Enter String 1: welcome
Enter String 2: welcome
welcome is same as welcome
Comment

strncmp

#include <stdio.h>
#include <string.h>

int main () {
   char str1[15];
   char str2[15];
   int ret;

   strcpy(str1, "abcdef");
   strcpy(str2, "ABCDEF");

   ret = strncmp(str1, str2, 4);

   if(ret < 0) {
      printf("str1 is less than str2");
   } else if(ret > 0) {
      printf("str2 is less than str1");
   } else {
      printf("str1 is equal to str2");
   }
   
   return(0);
}
Comment

PREVIOUS NEXT
Code Example
C :: mark rober 
C :: c get string 
C :: C Create struct Variables 
C :: Recommended compiler and linker flags for GCC 
C :: arduino analogwrite 
Dart :: remove number count in textfield flutter 
Dart :: flutter debug tag 
Dart :: How to attach a FloatingActionButton to the AppBar 
Dart :: decode, encode base64 dart 
Dart :: flutter label alignment top 
Dart :: dart datetime parse 
Dart :: multi dex flutter 
Dart :: how to find the type of object in dart 
Dart :: flutter run code after build 
Dart :: dart timer 
Dart :: flutter cliprrect 
Dart :: into to char dart 
Dart :: flutter getx snackbar 
Dart :: flutter round container 
Dart :: flutter text button 
Dart :: RenderFlex overflowed 
Dart :: image from assets in flutter 
Dart :: flutter audio player get duration 
Dart :: size row to maximum flutter 
Dart :: sort list bool dart 
Dart :: Flutter Popup Menu Button Example Tutorial 
Dart :: dart what is a closure 
Dart :: consumer flutter 
Dart :: ink image clip flutter 
Dart :: data types in flutter 
ADD CONTENT
Topic
Content
Source link
Name
9+3 =