Hi,
I have an array of char (char cmd[]="1234" and i want to convert it to a char (char cmd1="1234"
I need to compare the char. If i'm using an array i need to use a for but i want to use something like:
if(cmd1 == "1234"){
....
....
}
Hi,
I have an array of char (char cmd[]="1234" and i want to convert it to a char (char cmd1="1234"
I need to compare the char. If i'm using an array i need to use a for but i want to use something like:
if(cmd1 == "1234"){
....
....
}
see the strcmp function: http://www.cplusplus.com/reference/clibrary/cstring/strcmp/
Can i use that function on Arduino?
Can i compare an array of char (char cmd[5]="1234") with a char (cmd1="1234") ?
Can i use that function on Arduino?
Can i compare an array of char (char cmd[5]="1234") with a char (cmd1="1234") ?
Yes and yes
thanks
That fubction have better performance then a FOR cycle?
I expect you would not notice any difference in performance between calling strcmp and doing an explicit compare in a for loop