Thread: Test datatype

  1. #1
    Registered User
    Join Date
    Oct 2011
    Posts
    20

    Test datatype

    Hello again. Today I don't actually have a problem just a question. How do I test the datatype a user inputted for example: I ask to enter an int and they enter a char instead , is there anyway to prevent them from doing this or allow me to loop so I can stop program from crashing? as usual thanks for any and all help

  2. #2
    Registered User
    Join Date
    Nov 2011
    Posts
    63
    ctype.h has some useful functions. You can also check the return values of functions such as scanf or atoi.

  3. #3
    Registered User
    Join Date
    Oct 2011
    Posts
    20
    I'll look into it thanks

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. datatype bit?
    By MK27 in forum C Programming
    Replies: 3
    Last Post: 02-05-2009, 01:56 PM
  2. Datatype
    By ssharish2005 in forum C Programming
    Replies: 6
    Last Post: 08-04-2008, 12:53 PM
  3. C datatype, enumerator
    By onebrother in forum C Programming
    Replies: 3
    Last Post: 07-26-2007, 12:49 AM
  4. DataType* MyVar;
    By GetAGrip in forum C Programming
    Replies: 3
    Last Post: 01-30-2006, 01:29 PM
  5. Test at http://www.artlogic.com/careers/test.html
    By zMan in forum C++ Programming
    Replies: 6
    Last Post: 07-15-2003, 06:11 AM