close
比較 (1) :
char * a = "Hello Loli";
char * b = "Hello Loli";
if (a == b){
printf ("Y\n");
}else{
printf ("N\n");
}
輸出:Y
-----------------------------------------------
char a [] = "Hello Loli";
-----------------------------------------------
比較 (2) :
char * a = "Hello Loli";
char * b = "Hello Loli";
if (!strcmp(a, b)){ // strcmp(a,b) 如果一樣則回傳0,所以加 ! 來反轉
printf ("Y\n");
}else{
printf ("N\n");
}
輸出:Y
-----------------------------------------------
-----------------------------------------------
比較 (3) :
char a [] = "Hello Loli";
char b [] = "Hello Loli";
if (a == b){
printf ("Y\n");
}else{
printf ("N\n");
}
輸出:N
-----------------------------------------------
比較 (4) :
-----------------------------------------------
比較 (4) :
char a [] = "Hello Loli";
char b [] = "Hello Loli";
if (!strcmp(a, b)){ // strcmp(a,b) 如果一樣則回傳0,所以加 ! 來反轉
printf ("Y\n");
}else{
printf ("N\n");
}
輸出:Y
-----------------------------------------------
-----------------------------------------------
比較 (5) :
char * a = "Hello Loli";
char b[] = "Hello Loli";
if (!strcmp(a, b)){ // strcmp(a,b) 如果一樣則回傳0,所以加 ! 來反轉
printf ("Y\n");
}else{
printf ("N\n");
}
輸出:Y
-----------------------------------------------
-----------------------------------------------
比較 (6) :
char * a = "Hello Loli";
if (!strcmp(a, "Hello Loli")){ // strcmp(a,b) 如果一樣則回傳0,所以加 ! 來反轉
printf ("Y\n");
}else{
printf ("N\n");
}
輸出:Y
-----------------------------------------------
-----------------------------------------------
比較 (7) :
char b [] = "Hello Loli";
if (!strcmp("Hello Loli", b)){ // strcmp(a,b) 如果一樣則回傳0,所以加 ! 來反轉
printf ("Y\n");
}else{
printf ("N\n");
}
輸出:Y
-----------------------------------------------
-----------------------------------------------
全站熱搜
留言列表