i couldnt execute the above programme using turbo c.Code:void main(){ char c; printf("Enter charactor"); scanf("%d",&c); if(c=='a') printf('YEs'); printf("Nope"); }
i couldnt execute the above programme using turbo c.Code:void main(){ char c; printf("Enter charactor"); scanf("%d",&c); if(c=='a') printf('YEs'); printf("Nope"); }
If you're expecting a character instead of a number, you should use scanf("%c",&c);
Also you are missing an 'else' between the printfs.
Unless you have the warnings shut off you should be receiving one about main returning an int.
It's always int main(void) or int main(argc, char *argv[]), never void main() or main().
Why TurboC especially when there are far better and much newer 32 bit compilers available for free on the web?
TurboC is a 16 bit dinosaur that is no longer supported on 64 bit systems... it's time to upgrade!
smorgasbordet - Pelles C
Download binary ... take the one with mingw included
Microsoft Express Downloads - Visual Studio Express and SQL Server Express ... take the free version of C++
All free... all better.
Also, did you do #include <stdio.h> /* required for printf */
Unfortunately Turbo C was designed in such a way that only correctly formatted code will work.
Ugly code will be rejected automagicly without giving any error. It was designed in this way in order to avoid any stupid f**king question like
and allow real experts to help by suggesting solutions and other compilers on more bits.Code:What do you mean by "don't work" ?
LOL, i suppose!
Devoted my life to programming...