ASCII - CodingTute https://codingtute.com/tag/ascii/ Learn to code in an easier way Sun, 02 Apr 2023 10:14:06 +0000 en-US hourly 1 https://wordpress.org/?v=6.5.3 https://codingtute.com/wp-content/uploads/2021/06/cropped-codingtute_favicon-32x32.png ASCII - CodingTute https://codingtute.com/tag/ascii/ 32 32 187525380 C Program to Display Alphabets https://codingtute.com/c-program-to-display-alphabets/ Thu, 04 Nov 2021 18:51:21 +0000 https://codingtute.com/?p=2885 In this example, you will learn to display alphabets sequentially using loops and ASCII values. You can find more about ASCII here. C Program to Display Uppercase Alphabets Output C Program to Display Lowercase Alphabets Output Explanation We know each character holds a unique ASCII value. For uppercase alphabets (A-Z) the ASCII value ranges between ... Read more

The post C Program to Display Alphabets appeared first on CodingTute.

]]>
In this example, you will learn to display alphabets sequentially using loops and ASCII values.

You can find more about ASCII here.

C Program to Display Uppercase Alphabets

#include <stdio.h>

int main()
{
    //ASCII values of A - Z (65 - 90) 
    for(int i = 65; i < 91; i++)
        printf("%c ",i);
}

Output

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

C Program to Display Lowercase Alphabets

#include <stdio.h>

int main()
{
    //ASCII values of a - z (97 - 122) 
    for(int i = 97; i < 123; i++)
        printf("%c ",i);
}

Output

a b c d e f g h i j k l m n o p q r s t u v w x y z 

Explanation

We know each character holds a unique ASCII value. For uppercase alphabets (A-Z) the ASCII value ranges between 65-90 respectively and for lowercase alphabets (a-z) the ASCII value ranges between 97-122. In our c program, we loop within the range of alphabets and print the loop variable i with format specifier %c which in terms prints the respective character.

Follow us on Facebook, YouTube, Instagram, and Twitter for more exciting content and the latest updates.

The post C Program to Display Alphabets appeared first on CodingTute.

]]>
2885
C Program to Find ASCII Value of a Character https://codingtute.com/c-program-to-find-ascii-value-of-a-character/ Thu, 19 Aug 2021 06:15:05 +0000 https://codingtute.com/?p=2662 In this example, you will learn how to find an ASCII value of a character. ASCII stands for American Standard Code for Information Interchange. It is one of the standards of representing characters to transfer information electronically. You can get to know more about ASCII here. Program to find ASCII Value of a Character Output ... Read more

The post C Program to Find ASCII Value of a Character appeared first on CodingTute.

]]>
In this example, you will learn how to find an ASCII value of a character. ASCII stands for American Standard Code for Information Interchange. It is one of the standards of representing characters to transfer information electronically.

You can get to know more about ASCII here.

Program to find ASCII Value of a Character

#include <stdio.h>
int main() {  
    char ch;
    printf("Enter a character: ");
    scanf("%c", &ch);  
    
    // %c displays the actual character
    // %d displays the integer value of a character
    printf("ASCII value of %c is %d", ch, ch);
    
    return 0;
}
Run Code on Online C Compiler

Output

Enter a character: B 
ASCII value of B is 66

Explanation

This C program asks the user to enter a character, reads the character using scanf(), and then displays the ASCII value of the character using printf().

The program first declares a variable ch of type char to store the user input. Then, it prints a message to the console asking the user to enter a character using printf(). The scanf() function is used to read the character entered by the user, and the address of ch is passed as the second argument to scanf() using the & operator to ensure that the value entered by the user is stored in the memory location reserved for the ch variable.

Next, the program uses printf() to display the ASCII value of the character entered by the user. The %c format specifier is used to display the actual character, and the %d format specifier is used to display the integer value of the character in ASCII encoding. The value of the ch variable is passed as the first argument to printf() to display the character itself, and it is also passed as the second argument to printf() with %d format specifier to display its ASCII value.

Finally, the program returns 0 to indicate successful completion of the main() function.

As per the ASCII, each character holds a unique ASCII value between 0-127.

Example: ‘A’ holds the value 65, ‘B’ holds the value 66 etc. For further values please refer the ASCII Table.

Follow us on Facebook, YouTube, Instagram, and Twitter for more exciting content and the latest updates.

The post C Program to Find ASCII Value of a Character appeared first on CodingTute.

]]>
2662
ASCII Table https://codingtute.com/ascii-table/ Sat, 14 Aug 2021 19:42:05 +0000 https://codingtute.com/?p=2663 ASCII stands for American Standard Code for Information Interchange. It is a character encoding standard for electronic communication. Specified 128 characters encoded into seven-bit integers to represent ASCII. ASCII Control Characters The first 32 characters (0 – 31) in the ASCII table are known as control characters, which are unprintable codes and are used to ... Read more

The post ASCII Table appeared first on CodingTute.

]]>
ASCII stands for American Standard Code for Information Interchange. It is a character encoding standard for electronic communication. Specified 128 characters encoded into seven-bit integers to represent ASCII.

ASCII Control Characters

The first 32 characters (0 – 31) in the ASCII table are known as control characters, which are unprintable codes and are used to control the peripherals.

DECBINOCTHEXSymbolDescription
0000NULNull char
1111SOHStart of Heading
21022STXStart of Text
31133ETXEnd of Text
410044EOTEnd of Transmission
510155ENQEnquiry
611066ACKAcknowledgment
711177BELBell
81000108BSBack Space
91001119HTHorizontal Tab
101010120ALFLine Feed
111011130BVTVertical Tab
121100140CFFForm Feed
131101150DCRCarriage Return
141110160ESOShift Out / X-On
151111170FSIShift In / X-Off
16100002010DLEData Line Escape
17100012111DC1Device Control 1 (oft. XON)
18100102212DC2Device Control 2
19100112313DC3Device Control 3 (oft. XOFF)
20101002414DC4Device Control 4
21101012515NAKNegative Acknowledgement
22101102616SYNSynchronous Idle
23101112717ETBEnd of Transmit Block
24110003018CANCancel
25110013119EMEnd of Medium
2611010321ASUBSubstitute
2711011331BESCEscape
2811100341CFSFile Separator
2911101351DGSGroup Separator
3011110361ERSRecord Separator
3111111371FUSUnit Separator

ASCII Printable Characters

The 32 – 127 codes in the ASCII table are printable characters, which represent letters, numbers, punctuation marks, and few other symbols.

DECBINOCTHEXSymbolDescription
321000004020Space
331000014121!Exclamation mark
341000104222Double quotes (or speech marks)
351000114323#Number
361001004424$Dollar
371001014525%Per cent sign
381001104626&Ampersand
391001114727Single quote
401010005028(Open parenthesis (or open bracket)
411010015129)Close parenthesis (or close bracket)
42101010522A*Asterisk
43101011532B+Plus
44101100542C,Comma
45101101552DHyphen
46101110562E.Period, dot or full stop
47101111572F/Slash or divide
4811000060300Zero
4911000161311One
5011001062322Two
5111001163333Three
5211010064344Four
5311010165355Five
5411011066366Six
5511011167377Seven
5611100070388Eight
5711100171399Nine
58111010723A:Colon
59111011733B;Semicolon
60111100743C<Less than (or open angled bracket)
61111101753D=Equals
62111110763E>Greater than (or close angled bracket)
63111111773F?Question mark
64100000010040@At symbol
65100000110141AUppercase A
66100001010242BUppercase B
67100001110343CUppercase C
68100010010444DUppercase D
69100010110545EUppercase E
70100011010646FUppercase F
71100011110747GUppercase G
72100100011048HUppercase H
73100100111149IUppercase I
7410010101124AJUppercase J
7510010111134BKUppercase K
7610011001144CLUppercase L
7710011011154DMUppercase M
7810011101164ENUppercase N
7910011111174FOUppercase O
80101000012050PUppercase P
81101000112151QUppercase Q
82101001012252RUppercase R
83101001112353SUppercase S
84101010012454TUppercase T
85101010112555UUppercase U
86101011012656VUppercase V
87101011112757WUppercase W
88101100013058XUppercase X
89101100113159YUppercase Y
9010110101325AZUppercase Z
9110110111335B[Opening bracket
9210111001345C\Backslash
9310111011355D]Closing bracket
9410111101365E^Caret – circumflex
9510111111375F_Underscore
96110000014060`Grave accent
97110000114161aLowercase a
98110001014262bLowercase b
99110001114363cLowercase c
100110010014464dLowercase d
101110010114565eLowercase e
102110011014666fLowercase f
103110011114767gLowercase g
104110100015068hLowercase h
105110100115169iLowercase i
10611010101526AjLowercase j
10711010111536BkLowercase k
10811011001546ClLowercase l
10911011011556DmLowercase m
11011011101566EnLowercase n
11111011111576FoLowercase o
112111000016070pLowercase p
113111000116171qLowercase q
114111001016272rLowercase r
115111001116373sLowercase s
116111010016474tLowercase t
117111010116575uLowercase u
118111011016676vLowercase v
119111011116777wLowercase w
120111100017078xLowercase x
121111100117179yLowercase y
12211110101727AzLowercase z
12311110111737B{Opening brace
12411111001747C|Vertical bar
12511111011757D}Closing brace
12611111101767E~Equivalency sign – tilde
12711111111777FDELDelete

The post ASCII Table appeared first on CodingTute.

]]>
2663