{"id":4331,"date":"2022-12-08T18:19:04","date_gmt":"2022-12-08T18:19:04","guid":{"rendered":"https:\/\/gyanipandit.com\/programming\/?p=4331"},"modified":"2022-12-08T18:19:05","modified_gmt":"2022-12-08T18:19:05","slug":"how-to-find-ascii-value-in-c","status":"publish","type":"post","link":"https:\/\/gyanipandit.com\/programming\/how-to-find-ascii-value-in-c\/","title":{"rendered":"How to Find ASCII Value in C"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">How to Find ASCII Value in C<\/h2>\n\n\n\n<p>In this article, we are going to discuss how to find the ASCII value of the character. So this is a very simple program so let&#8217;s start implementing this.<\/p>\n\n\n\n<p>ASCII \u2013 American standard code information interchange.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">For example-<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\">input:<\/h4>\n\n\n\n<p>so basically we are taking user input in these programs, so we are going to take characters from the user.<\/p>\n\n\n\n<p>For example, we take &amp;<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Logic:<\/h4>\n\n\n\n<p>We have to simply print the ASCII value of the character for that we simply print the value of the character in int data type.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Output :<\/h4>\n\n\n\n<p>According to our input, we get the ASCII value of our character as follows:<\/p>\n\n\n\n<p>The ASCII value is 38<\/p>\n\n\n\n<p>So let&#8217;s try to implement this example in our program!<\/p>\n\n\n\n<p>C program to find the ASCII value of the character.<\/p>\n\n\n\n<p class=\"has-white-color has-black-background-color has-text-color has-background\">#include&lt;stdio.h&gt;<br>int main(){<br>char ch ;<br>printf(&#8220;Enter character :&#8221;);<br>scanf(&#8220;%c&#8221;, &amp;ch);<br>printf(&#8220;The ASCII value is %d&#8221;, ch);<br>return 0;<\/p>\n\n\n\n<p class=\"has-white-color has-black-background-color has-text-color has-background\">}<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Output<\/h4>\n\n\n\n<p>Enter character :&amp;<\/p>\n\n\n\n<p>The ASCII value is 38<\/p>\n\n\n\n<p>Step 1: First take a char-type variable to take input from the user.<\/p>\n\n\n\n<p>Step 2: use scaf() to store the value of the character and for that, we use %c format specifier because we get a character from the user. From the above program, we can see that.<\/p>\n\n\n\n<p>Step 3: After these two steps simply use printf() statement to get our output and for that, we simply use %d format specifies because we get output in the form of an integer.<\/p>\n\n\n\n<p>In this way, we simply understand how to find the ASCII value of the character. I hope this thing is clear to you. So for now keep learning and keep exploring!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>How to Find ASCII Value in C In this article, we are going to discuss how to find the ASCII value of the character. So this is a very simple program so let&#8217;s start implementing this. ASCII \u2013 American standard code information interchange. For example- input: so basically we are taking user input in these [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[30],"tags":[29,48],"class_list":{"0":"post-4331","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-c-program","7":"tag-c-program","8":"tag-how-to-find-ascii-value-in-c"},"_links":{"self":[{"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/posts\/4331","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/comments?post=4331"}],"version-history":[{"count":1,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/posts\/4331\/revisions"}],"predecessor-version":[{"id":4332,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/posts\/4331\/revisions\/4332"}],"wp:attachment":[{"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/media?parent=4331"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/categories?post=4331"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/tags?post=4331"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}