Introduction

The main purpose of this blog is to share our experience with the world and get experience from the world. This will be a new venture for us and we are sure, we shall learn a lot with it. we will try to Explore our mind which will be very helpful for all us. As from its name, its a blog covering all the topics. we will try to post all the interesting topics and give our opinion. Do give your point of view in comments.


"NAVIGATE VIA BLOG ARCHIVE ON RIGHT TO GET WHAT YOU ARE LOOKING FOR"


Sunday, February 6, 2011

How to use ctype.h functions

The following codes shows how to use isdigit(), isalpha(), isalnum(), isxdigit(), isspace(), iscntrl(), ispunct(), isprint(), isgraph(),
include<stdio.h>
#include<ctype.h>
int main()
{int i;
char f;
printf("enter character\n");
scanf("%c",&f);
i=isdigit(f);
if(i==0)printf("not digit\n");else printf("is digit\n");
i=isalpha(f);
if(i==0)printf("not alpha\n");else printf("is alpha\n");
i=isalnum(f);
if(i==0)printf("not digit or aplha\n");else printf("is digit or alpha\n");
i=isxdigit(f);
if(i==0)printf("not xdigit\n");else printf("is xdigit\n");
i=isspace(f);
if(i==0)printf("not space\n");else printf("is space\n");
i=iscntrl(f);
if(i==0)printf("not cntrl\n");else printf("is cntrl\n");
i=ispunct(f);
if(i==0)printf("not punct\n");else printf("is punct\n");
i=isprint(f);
if(i==0)printf("not print\n");else printf("is print\n");
i=isgraph(f);
if(i==0)printf("not graph\n");else printf("is graph\n");
}

No comments:

Post a Comment

Related Posts with Thumbnails