Strncmp.c
Upload User: dq031136
Upload Date: 2022-08-08
Package Size: 802k
Code Size: 1k
Development Platform:

C++ Builder

  1. #include <stdio.h>
  2. #include <string.h>
  3. void main(void)
  4.  {
  5.    printf("Comparing 3 letters Abc with Abc %dn", 
  6.      strncmp("Abc", "Abc", 3));
  7.    printf("Comparing 3 letters abc with Abc %dn", 
  8.      strncmp("abc", "Abc", 3));
  9.    printf("Comparing 3 letters abcd with abc %dn", 
  10.      strncmp("abcd", "abc", 3));
  11.    printf("Comparing 5 letters Abc with Abcd %dn", 
  12.      strncmp("Abc", "Abcd", 5));
  13.    printf("Comparing 4 letters abcd with abcd %dn", 
  14.      strncmp("abcd", "abcd", 4));
  15.  }