I tried running a C program with the code:
#include <stdio.h>
#include <stdlib.h>
int main(void) {
char grade;
float mark;
printf("Enter total mark percentage : ");
scanf("%f", &mark);
if(mark>=90){
grade="A";
}else{
grade="B";
}
printf("Your grade is %c", grade);
return EXIT_SUCCESS;
}
It produces a warning 'assignment from 'char' to 'char*' makes integer from pointer without a cast'.
I am able to solve it by changing " to ' in line 10 and 12
grade='A';
}else{
grade='B';
}
This solves the warning. But I want to use " to contain A & B. I tried initializing mark, as int instead of char in line 5 but it also didn't work. I just want to know what is the difference in using ' and " .