the correct syntax for ''char'' type
hi have to make a simple calculator for my prog course but the teacher didn't give the explanation about the char type
so my prog will look like this
Code:
int main (void)
{
float a,b,c;
char operation[1];
printf("Calculatrice de base\n entre les operation sous la forme a () b");
printf("\n***************************");
printf("\n + (addition) *");
printf("\n - (soustraction) *");
printf("\n * (multiplication) *");
printf("\n / (division) *");
printf("\n t (terminer le programme)*");
printf("\n***************************\n");
scanf("%f",&a);
scanf("%s",operation);
scanf("%s",b);
if (operation=='+')
printf("\n %f + %f = %f",a,b,(a+b));
if (operation=='-')
printf("\n %f - %f = %f",a,b,(a-b));
if (operation=='*')
printf("\n %f * %f = %f",a,b,(a*b));
if (operation=='/')
{if (b==0)
printf("division pas 0 impossible !!!");
else printf("\n %f / %f = %f",a,b,(a/b));
}
if (operation=='t')
return 0;
getch();
return 0;
}
EROR MESSAGE:
[Warning] comparison between pointer and integer
at each ''if''
i don't want you to programm it but can you tell me the correct way to write the char declaration and if i can do a comparison with char like i did if yes, how to do it correctly