My issue
How can I get rid of “Run time error”?
My code
#include <stdio.h>
int main(void) {
char fruit = "Apple";
printf("%s",fruit);
return 0;
}
Learning course: Learn C
Problem Link: CodeChef: Practical coding for everyone
How can I get rid of “Run time error”?
#include <stdio.h>
int main(void) {
char fruit = "Apple";
printf("%s",fruit);
return 0;
}
Learning course: Learn C
Problem Link: CodeChef: Practical coding for everyone
@rohith51
U have to do it like this.
#include <stdio.h>
int main() {
char fruit[] = "Apple";
printf("%s", fruit);
return 0;
}
Do not use void in main instead leave as it blank i.e
int main() or write int main(args str[]) or int main(int argc , char *argv[])
so code will be :
int main() {
char fruit[] = “Apple” ;
printf(“%s”, fruit);
return 0;
}