I have made this little test program in c on my raspberry pi model b.
It compiles without errors, however, the if statement never works:
#include <stdio.h>
#include <unistd.h>
int main(int argc, const char * argv[])
{
char *test = 0;
printf("Alpha or Beta\n");
scanf(" %s", test);
if (test == "Alpha")
{
printf("This is string one test\n");
printf("This is string two test\n");
}
else
{
printf("An error has occured\n");
}
return 0;
}
For example: I will type Alpha and it will always give me the error has occurred message.