Home / Programming / Print Special Character using ASCII code in C programming

Print Special Character using ASCII code in C programming

Hi, Hope everyone are in good health. Today I will you how to print special character and alphabets in C programming language using ASCII codes. It is very simple and easy.

 

Source Code:

1 #include<stdio.h>
2
3 int main()
4 {
5      int n;
6      n=33;
7
8      printf(“%c”,n);
9 }

 

Explanation:

As you can see, we declare an integer variable ‘n’. We initialized the variable to 33. Now here is the twist. In the printf() function we use the format specifier “%c” which is for character. So, it will print a character. Which character? As ‘n’ is carrying the 33, this will print the character followed by the ASCII Table. Try changing the value of ‘n’. ASCII-8 contains 255 character.

 

Find out the full ASCII Table from here.

 ASCII Table  ASCII Table

You can try something like the following image using ASCII codes:

9YRMc

 

Thank you. Have fun. Happy Coding 🙂

 

About Ahmadnan

Check Also

See Through Wallpaper for iPhone X

Thanks to ifixit.org for introducing wallpapers by using which you can make your iPhone X more ...

Leave a Reply

Your email address will not be published. Required fields are marked *


*

Powered by themekiller.com anime4online.com animextoon.com apk4phone.com