将字符串值00与int值0(不是1)进行比较

Comparing a string value of 00 to an int value of 0 not 1

本文关键字:比较 不是 字符串 int      更新时间:2023-10-16

我有一个值为00的字符数组charArray。CCD_ 3产生1而不是0。我想把00转换成0。

以下操作很好。http://ideone.com/dpTMQq

#include <stdlib.h>
#include <assert.h>
int main( void ) {
    char charArray[] = "00";
    int intValue = atoi( charArray );
    assert( intValue == 0 );
}