I am new to C. This code runs on a Flyport module and compiles on their own IDE but I should think my error should be easy to spot for anyone familiar with C.
I can't get this code to compile despite changing almost everything, what am I doing wrong?
char string_serial[50]="starting Value";
if (string_serial[0] = "*")
{
UARTWrite(2,"First Char OK");
UARTWrite(2,"\r\n");
else
UARTWrite(2,"First Char NOT OK");
UARTWrite(2,"\r\n");
}
If it's not obvious I am trying to check if character 0 in the array is *.
Thanks
const char [2]to be exact). Use single quotes for characters => '*'. Line 3: you have a braces problem, the correct syntax is =>if (/* condition /*) { /* code if true */ } else { /* code if false /* }