about turboc

This is a discussion on about turboc within the C Programming forums, part of the General Programming Boards category; 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 ...

  1. #1
    Registered User
    Join Date
    Mar 2011
    Posts
    2

    about turboc

    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.

  2. #2
    Registered User
    Join Date
    Sep 2008
    Location
    Toronto, Canada
    Posts
    1,832
    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.

  3. #3
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    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().

  4. #4
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    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.

  5. #5
    Registered User
    Join Date
    Mar 2011
    Posts
    3
    Also, did you do #include <stdio.h> /* required for printf */

  6. #6
    Registered User
    Join Date
    Mar 2011
    Posts
    2

    Talking

    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
    Code:
    What do you mean by "don't work" ?
    and allow real experts to help by suggesting solutions and other compilers on more bits.
    Attached Images Attached Images   

  7. #7
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    1,625
    LOL, i suppose!
    Devoted my life to programming...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem with BGI graphics: Linker Error
    By darklord1984 in forum C++ Programming
    Replies: 9
    Last Post: 11-10-2007, 10:16 AM
  2. TurboC returns malloc() NULL
    By Yarin in forum C++ Programming
    Replies: 5
    Last Post: 09-10-2007, 04:35 PM
  3. problem installing TURBOC in my system
    By ss12 in forum C++ Programming
    Replies: 3
    Last Post: 03-18-2005, 07:57 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21