logo

C의 ASCII 테이블

이 주제에서는 ASCII 코드와 C 프로그래밍 언어로 ASCII 테이블을 인쇄하는 프로그램을 작성하는 방법에 대해 설명합니다. ASCII는 다음을 의미합니다. 정보 교환을 위한 미국 표준 코드 . ASCII 코드는 컴퓨터 및 기타 전자 장치에서 정보를 교환하기 위한 기본 문자 요소의 값을 정의하는 데 사용되는 문자 인코딩 체계입니다.

C의 ASCII 테이블

또한 ASCII 코드는 표준 ASCII 코드와 확장 ASCII 코드의 두 부분으로 나누어진 문자 세트의 255개 기호 모음입니다. 표준 ASCII 코드 범위는 0부터 127까지이고 길이는 7비트이며, 확장 ASCII 코드인 128부터 255까지의 길이는 8비트입니다. 이러한 문자는 기호문자(대문자 및 소문자(a-z, AZ), 숫자(0-9), 특수문자(!, @, #, $ 등), 문장부호, 제어문자의 조합입니다. 즉, 각 문자에는 고유한 ASCII 값이 있습니다.

예를 들어, 'HELLO'라는 문자열을 입력하면 컴퓨터 기계는 우리가 입력한 문자열을 직접 저장하지 않습니다. 대신 시스템은 '7269767679'와 같은 해당 ASCII 값으로 문자열을 저장합니다. H의 ASCII 값은 72, E는 69, L은 76, O는 79입니다.

대문자의 ASCII 값을 구하는 프로그램

프로그램.c

 #include int main() { // declare local variable int caps; // use for loop to print the capital letter from A to Z for ( caps = 65; caps <91; caps++) { printf (' 
 the ascii value of %c is %d ', caps, caps); } return 0; < pre> <p> <strong>Output</strong> </p> <pre> The ASCII value of A is 65 The ASCII value of B is 66 The ASCII value of C is 67 The ASCII value of D is 68 The ASCII value of E is 69 The ASCII value of F is 70 The ASCII value of G is 71 The ASCII value of H is 72 The ASCII value of I is 73 The ASCII value of J is 74 The ASCII value of K is 75 The ASCII value of L is 76 The ASCII value of M is 77 The ASCII value of N is 78 The ASCII value of O is 79 The ASCII value of P is 80 The ASCII value of Q is 81 The ASCII value of R is 82 The ASCII value of S is 83 The ASCII value of T is 84 The ASCII value of U is 85 The ASCII value of V is 86 The ASCII value of W is 87 The ASCII value of X is 88 The ASCII value of Y is 89 The ASCII value of Z is 90 </pre> <h3>Program to get the ASCII value of the small letters</h3> <p> <strong>Program2.c</strong> </p> <pre> #include int main() { // declare local variable int small; // use for loop to print the small alphabets letter from a to z for ( small = 97; small <123; small++) { display ascii values to its equivalent characters printf (' 
 the value of %c is %d ', small, small); } return 0; < pre> <p> <strong>Output</strong> </p> <pre> The ASCII value of a is 97 The ASCII value of b is 98 The ASCII value of c is 99 The ASCII value of d is 100 The ASCII value of e is 101 The ASCII value of f is 102 The ASCII value of g is 103 The ASCII value of h is 104 The ASCII value of i is 105 The ASCII value of j is 106 The ASCII value of k is 107 The ASCII value of l is 108 The ASCII value of m is 109 The ASCII value of n is 110 The ASCII value of o is 111 The ASCII value of p is 112 The ASCII value of q is 113 The ASCII value of r is 114 The ASCII value of s is 115 The ASCII value of t is 116 The ASCII value of u is 117 The ASCII value of v is 118 The ASCII value of w is 119 The ASCII value of x is 120 The ASCII value of y is 121 The ASCII value of z is 122 </pre> <h3>Program to get the ASCII value of the given characters</h3> <p> <strong>Program3.c</strong> </p> <pre> #include int main() { char arr[30]; // declare the size of character array int count = 0; // declare a count variable // enter any name to get the ascii codes printf (&apos; 
 Enter the name to get the ASCII codes: &apos;); scanf (&apos; %s&apos;, &amp;arr); // use while loop to sequentially iterate every characters of the array while (arr[count] != &apos;&apos;) { // display the character name one by one printf (&apos; 
 The ascii code of the character %c is %d &apos;, arr[count], arr[count]); count++; // increment one by one } return 0; } </pre> <p> <strong>Output</strong> </p> <pre> Enter the name to get the ASCII codes: JAVATPOINT The ASCII code of the character J is 74 The ASCII code of the character A is 65 The ASCII code of the character V is 86 The ASCII code of the character A is 65 The ASCII code of the character T is 84 The ASCII code of the character P is 80 The ASCII code of the character O is 79 The ASCII code of the character I is 73 The ASCII code of the character N is 78 The ASCII code of the character T is 84 </pre> <h3>Program to get the ASCII value of the special characters</h3> <p> <strong>Program4.c</strong> </p> <pre> #include int main() { // declare a variable int specialCh; for (specialCh = 33; specialCh <48; specialch++) { printf (' 
 the ascii value of '%c' special character is: %d', specialch, specialch); } for (specialch="58;" specialch < 65; 127; return 0; pre> <p> <strong>Output</strong> </p> <pre> The ASCII value of &apos;!&apos; special character is: 33 The ASCII value of &apos;&apos;&apos; special character is: 34 The ASCII value of &apos;#&apos; special character is: 35 The ASCII value of &apos;$&apos; special character is: 36 The ASCII value of &apos;%&apos; special character is: 37 The ASCII value of &apos;&amp;&apos; special character is: 38 The ASCII value of &apos;&apos;&apos; special character is: 39 The ASCII value of &apos;(&apos; special character is: 40 The ASCII value of &apos;)&apos; special character is: 41 The ASCII value of &apos;*&apos; special character is: 42 The ASCII value of &apos;+&apos; special character is: 43 The ASCII value of &apos;,&apos; special character is: 44 The ASCII value of &apos;-&apos; special character is: 45 The ASCII value of &apos;.&apos; special character is: 46 The ASCII value of &apos;/&apos; special character is: 47 The ASCII value of &apos;:&apos; special character is: 58 The ASCII value of &apos;;&apos; special character is: 59 The ASCII value of &apos;&apos; special character is: 62 The ASCII value of &apos;?&apos; special character is: 63 The ASCII value of &apos;@&apos; special character is: 64 The ASCII value of &apos;&apos; special character is: 124 The ASCII value of &apos;&apos; special character is: 125 The ASCII value of &apos;~&apos; special character is: 126 </pre> <h3>Program to print the complete ASCII tables in C</h3> <p> <strong>Program6.c</strong> </p> <pre> #include int main() { // declare a variable int asciTable; printf (&apos; The complete ASCII table of the characters in the C &apos;); for (asciTable = 0; asciTable <255; ascitable++) { printf (' 
 the value of '%c' character is: %d', ascitable, ascitable); } return 0; < pre> <p> <strong>Output</strong> </p> <img src="//techcodeview.com/img/c-tutorial/14/ascii-table-c-2.webp" alt="ASCII Table in C"> <hr></255;></pre></48;></pre></123;></pre></91;>

소문자의 ASCII 값을 얻는 프로그램

프로그램2.c

 #include int main() { // declare local variable int small; // use for loop to print the small alphabets letter from a to z for ( small = 97; small <123; small++) { display ascii values to its equivalent characters printf (\' 
 the value of %c is %d \', small, small); } return 0; < pre> <p> <strong>Output</strong> </p> <pre> The ASCII value of a is 97 The ASCII value of b is 98 The ASCII value of c is 99 The ASCII value of d is 100 The ASCII value of e is 101 The ASCII value of f is 102 The ASCII value of g is 103 The ASCII value of h is 104 The ASCII value of i is 105 The ASCII value of j is 106 The ASCII value of k is 107 The ASCII value of l is 108 The ASCII value of m is 109 The ASCII value of n is 110 The ASCII value of o is 111 The ASCII value of p is 112 The ASCII value of q is 113 The ASCII value of r is 114 The ASCII value of s is 115 The ASCII value of t is 116 The ASCII value of u is 117 The ASCII value of v is 118 The ASCII value of w is 119 The ASCII value of x is 120 The ASCII value of y is 121 The ASCII value of z is 122 </pre> <h3>Program to get the ASCII value of the given characters</h3> <p> <strong>Program3.c</strong> </p> <pre> #include int main() { char arr[30]; // declare the size of character array int count = 0; // declare a count variable // enter any name to get the ascii codes printf (&apos; 
 Enter the name to get the ASCII codes: &apos;); scanf (&apos; %s&apos;, &amp;arr); // use while loop to sequentially iterate every characters of the array while (arr[count] != &apos;&apos;) { // display the character name one by one printf (&apos; 
 The ascii code of the character %c is %d &apos;, arr[count], arr[count]); count++; // increment one by one } return 0; } </pre> <p> <strong>Output</strong> </p> <pre> Enter the name to get the ASCII codes: JAVATPOINT The ASCII code of the character J is 74 The ASCII code of the character A is 65 The ASCII code of the character V is 86 The ASCII code of the character A is 65 The ASCII code of the character T is 84 The ASCII code of the character P is 80 The ASCII code of the character O is 79 The ASCII code of the character I is 73 The ASCII code of the character N is 78 The ASCII code of the character T is 84 </pre> <h3>Program to get the ASCII value of the special characters</h3> <p> <strong>Program4.c</strong> </p> <pre> #include int main() { // declare a variable int specialCh; for (specialCh = 33; specialCh <48; specialch++) { printf (\' 
 the ascii value of \'%c\' special character is: %d\', specialch, specialch); } for (specialch="58;" specialch < 65; 127; return 0; pre> <p> <strong>Output</strong> </p> <pre> The ASCII value of &apos;!&apos; special character is: 33 The ASCII value of &apos;&apos;&apos; special character is: 34 The ASCII value of &apos;#&apos; special character is: 35 The ASCII value of &apos;$&apos; special character is: 36 The ASCII value of &apos;%&apos; special character is: 37 The ASCII value of &apos;&amp;&apos; special character is: 38 The ASCII value of &apos;&apos;&apos; special character is: 39 The ASCII value of &apos;(&apos; special character is: 40 The ASCII value of &apos;)&apos; special character is: 41 The ASCII value of &apos;*&apos; special character is: 42 The ASCII value of &apos;+&apos; special character is: 43 The ASCII value of &apos;,&apos; special character is: 44 The ASCII value of &apos;-&apos; special character is: 45 The ASCII value of &apos;.&apos; special character is: 46 The ASCII value of &apos;/&apos; special character is: 47 The ASCII value of &apos;:&apos; special character is: 58 The ASCII value of &apos;;&apos; special character is: 59 The ASCII value of &apos;&apos; special character is: 62 The ASCII value of &apos;?&apos; special character is: 63 The ASCII value of &apos;@&apos; special character is: 64 The ASCII value of &apos;&apos; special character is: 124 The ASCII value of &apos;&apos; special character is: 125 The ASCII value of &apos;~&apos; special character is: 126 </pre> <h3>Program to print the complete ASCII tables in C</h3> <p> <strong>Program6.c</strong> </p> <pre> #include int main() { // declare a variable int asciTable; printf (&apos; The complete ASCII table of the characters in the C &apos;); for (asciTable = 0; asciTable <255; ascitable++) { printf (\' 
 the value of \'%c\' character is: %d\', ascitable, ascitable); } return 0; < pre> <p> <strong>Output</strong> </p> <img src="//techcodeview.com/img/c-tutorial/14/ascii-table-c-2.webp" alt="ASCII Table in C"> <hr></255;></pre></48;></pre></123;>

주어진 문자의 ASCII 값을 얻는 프로그램

프로그램3.c

 #include int main() { char arr[30]; // declare the size of character array int count = 0; // declare a count variable // enter any name to get the ascii codes printf (&apos; 
 Enter the name to get the ASCII codes: &apos;); scanf (&apos; %s&apos;, &amp;arr); // use while loop to sequentially iterate every characters of the array while (arr[count] != &apos;&apos;) { // display the character name one by one printf (&apos; 
 The ascii code of the character %c is %d &apos;, arr[count], arr[count]); count++; // increment one by one } return 0; } 

산출

 Enter the name to get the ASCII codes: JAVATPOINT The ASCII code of the character J is 74 The ASCII code of the character A is 65 The ASCII code of the character V is 86 The ASCII code of the character A is 65 The ASCII code of the character T is 84 The ASCII code of the character P is 80 The ASCII code of the character O is 79 The ASCII code of the character I is 73 The ASCII code of the character N is 78 The ASCII code of the character T is 84 

특수 문자의 ASCII 값을 얻는 프로그램

프로그램4.c

 #include int main() { // declare a variable int specialCh; for (specialCh = 33; specialCh <48; specialch++) { printf (\' 
 the ascii value of \'%c\' special character is: %d\', specialch, specialch); } for (specialch="58;" specialch < 65; 127; return 0; pre> <p> <strong>Output</strong> </p> <pre> The ASCII value of &apos;!&apos; special character is: 33 The ASCII value of &apos;&apos;&apos; special character is: 34 The ASCII value of &apos;#&apos; special character is: 35 The ASCII value of &apos;$&apos; special character is: 36 The ASCII value of &apos;%&apos; special character is: 37 The ASCII value of &apos;&amp;&apos; special character is: 38 The ASCII value of &apos;&apos;&apos; special character is: 39 The ASCII value of &apos;(&apos; special character is: 40 The ASCII value of &apos;)&apos; special character is: 41 The ASCII value of &apos;*&apos; special character is: 42 The ASCII value of &apos;+&apos; special character is: 43 The ASCII value of &apos;,&apos; special character is: 44 The ASCII value of &apos;-&apos; special character is: 45 The ASCII value of &apos;.&apos; special character is: 46 The ASCII value of &apos;/&apos; special character is: 47 The ASCII value of &apos;:&apos; special character is: 58 The ASCII value of &apos;;&apos; special character is: 59 The ASCII value of &apos;&apos; special character is: 62 The ASCII value of &apos;?&apos; special character is: 63 The ASCII value of &apos;@&apos; special character is: 64 The ASCII value of &apos;&apos; special character is: 124 The ASCII value of &apos;&apos; special character is: 125 The ASCII value of &apos;~&apos; special character is: 126 </pre> <h3>Program to print the complete ASCII tables in C</h3> <p> <strong>Program6.c</strong> </p> <pre> #include int main() { // declare a variable int asciTable; printf (&apos; The complete ASCII table of the characters in the C &apos;); for (asciTable = 0; asciTable <255; ascitable++) { printf (\' 
 the value of \'%c\' character is: %d\', ascitable, ascitable); } return 0; < pre> <p> <strong>Output</strong> </p> <img src="//techcodeview.com/img/c-tutorial/14/ascii-table-c-2.webp" alt="ASCII Table in C"> <hr></255;></pre></48;>

C에서 전체 ASCII 테이블을 인쇄하는 프로그램

프로그램6.c

 #include int main() { // declare a variable int asciTable; printf (&apos; The complete ASCII table of the characters in the C &apos;); for (asciTable = 0; asciTable <255; ascitable++) { printf (\\' 
 the value of \\'%c\\' character is: %d\\', ascitable, ascitable); } return 0; < pre> <p> <strong>Output</strong> </p> <img src="//techcodeview.com/img/c-tutorial/14/ascii-table-c-2.webp" alt="ASCII Table in C"> <hr></255;>