[source code] C Programming Tutorial - 32 - A Few Cool Character Functions

+3 Bucky Roberts · August 7, 2014



#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>


int main()
{


   //in C, every integer has a character value
   //you can use ints and characters interchangeably in most cases


   int tuna = 'b'; // b, 7, $


   if( isalpha(tuna) ){
       printf("%c is a letter \n", tuna );
   }else{


       if( isdigit(tuna) ){
           printf("%c is a number \n", tuna );
       }else{
           printf("%c is not a OMG IDK! \n", tuna );
       }


   }


   return 0;
}


Post a Reply

Replies

Oldest  Newest  Rating
0 Ass Cold · October 29, 2014
Hello
when Bucky enter isalpha or isdigit, it have the drop down list, how come I don't have that on mine? can someone tell me why and how to get it?
  • 1

C

107,042 followers
About

One of the most popular languages of all time.

Links
Moderators
Bucky Roberts Administrator