Header Ads

ASCII Character Set:C Programming Language - Part 1.5

ASCII Character Set


ASCII means American Standard Code for Information Interchange This is a character-encoding scheme. There is a standard for every curator. Where the value of A is 65 Again, the value of small A is 97. Unless the value of 0 is 48. Let's see the table below



ASCII:ASCII



Every decaker and hexadecimal value of the cursor. It's called a map for every curator.

1
2
3
4
5
6
7
8
#include <stdio.h>

Int main ()
{
 Char ch = 'A';
 Printf ("% c", ch);
 Return 0;
}
In the above program, the variable A has a variable. Then we print it.

Now if you want to find A's ASCII value, then just change the placeholder to get the ASCII value of A if it returns% d:

1
2
3
4
5
6
7
8
#include <stdio.h>

Int main ()
{
 Char ch = 'A';
 Printf ("% d", ch);
 Return 0;
}
We can again convert the curator to 65. A. See the program below



1
2
3
4
5
6
7
8
#include <stdio.h>

Int main ()
{
 Char ch = 65;
 Printf ("% c", ch);
 Return 0;
}


In the above program, we put a curvaceous variable 65. When I print it out, I print it as a curator. And we got the output A.

Thus we can see with any other value.

Q: What print output can be done with char ch = 116?

Ctype.h: Character functions


We will now know about the functions that are in ctype.h.

The isdigit () function examines whether an input is 0-9 [0 1 2 3 4 5 6 7 8 9] numbers. See the program below. Before knowing the program below, we have an idea about if-else.



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <stdio.h>

Int main ()
{
 Int digit;
 Printf ("Enter a digit:");
 Scanf ("% c", & digit);

If (isdigit (digit)) {
 Printf ("You enter a digit and it is:% c", digit);
 } Else {
 Printf ("It was not a digit, digits are: 0 1 2 3 4 5 6 7 8 9");
 }
 Return (0);
}
We have given our input value in isdigit (). If we input a digit, then isdigit () returns true. And if inside the condition. If you input something other than a digit, then isdigit () returns false. And enter in else



Isalpha ()
If you pass a value with isalpha (), then check whether it is alphabet. Alphabet is A-Z and a-z. If we pass one of these, then the function will return any one value other than 0. That is true. If the alphabet is not, the return will be 0. Meaning lies Let's run the code below

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <stdio.h>

Int main ()
{
 Char alph;
 Printf ("Enter a alphabet:");
 Scanf ("% c", & alpha);

If (isalpha (alph)) {
 Printf ("You entered a alphabet and it is:% c", alpha);
 } Else {
 Printf ("It was not a alphabet");
 }
 Return (0);
}
Isalnum ()


Whether alphabet or numeric curator is checked with isalnum () Alphabet or Numeric Currers are called Alphanumeric.



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <stdio.h>

Int main ()
{
Char alphanumeric;
Printf ("Enter a Alphanumeric characters:");
Scanf ("% c", & alphanumeric);

If (isalnum (alphanumeric)) {
Printf ("You entered a alphanumeric and it is:% c", alphanumeric);
} Else {
Printf ("It was not a Alphanumeric character");
}
Return (0);
}


Islower ()
Test whether a letter is lower than islower (). If it is a small hand, then return true. Is not it false?



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <stdio.h>

Int main ()
{
Char ch;
Printf ("Enter a character:");
Scanf ("% c", & ch);

If (islower (ch)) {
Printf ("You entered lower case character", ch);
} Else {
Printf ("It was not a lower case character");
}
Return (0);
}


Isupper ()
Test the whether a letter is uppercase with isupper (). If it is the upper hand, then return true. Is not it false?





No comments

Theme images by sebastian-julian. Powered by Blogger.