c语言 strcmp函数_了解C ++ strcmp()函数

c语言 strcmp函数

Hello, folks! In this article, we will be focusing on the working of the C++ strcmp function in detail.

大家好! 在本文中,我们将重点关注C ++ strcmp函数的详细工作。

C ++ strcmp()函数入门 (Getting started with C++ strcmp() function)

C++ strcmp() function is an efficient way to compare two strings lexiographically.

C ++的strcmp()函数是比较两个串的有效方式lexiographically

The strcmp() function compares two input strings in a lexicographic manner and returns an integer value based on the outcome of the comparison of the two input strings.

strcmp()函数以字典方式比较两个输入字符串,并根据两个输入字符串的比较结果返回一个整数值。

By lexicographic comparison, we mean, that two strings are actually compared with their ASCII values of every character. If found same, zero is returned and the string is said to be equal.

通过词典比较,我们的意思是, 实际上将两个字符串与每个字符的ASCII值进行比较 。 如果发现相同,则返回零,并说该字符串相等。

Syntax:

句法:


strcmp(string1,string2)

Example:

例:


#include<stdio.h> 
#include<string.h> 
  
int main() 
{  
      
    char str1[] = "Python"; 
    char str2[] = "Python"; 
      
  
    if(strcmp(str1, str2)==0)
    printf("Strings are equal");
  
  • 2
    点赞
  • 13
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值