我有以下代码:
char* id = someFunction();
if (id == "0x01") {
id = ....
}
所以,我基本上需要的是检查 id
变量中是否有字符串值“0x01”,如果是,则将 {0x01, 0x00 传递到那里}
系统符号代替它。
感谢您的帮助。
最佳答案
使用strcmp()
.
该函数在string.h
中可用
Example:
printf( "Enter your name: " );
scanf( "%s", name );
if( strcmp( name, "Mary" ) == 0 )
printf( "Hello, Dr. Mary!\n" );
关于c - 如何将系统符号传递给 char*,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12858044/