Code to generate the map of India using the c language.

code in c to generate map of india

In this article, I am writing a c code to generate the map of INDIA. This program is an example of obfuscated code in C language. Here we will take an encoded long string. The long string is simply a binary sequence of characters.

Here string is a run-length encoding of the map of India. In which alternating characters stores how many times to draw a space, and how many times to draw an exclamation mark consecutively.


Note:  Here I am using Backslash at every end of the line to make the string continuous. If we miss the writing backslash at the end of every line then we will get the compiler error.

For learning more, you can signup for the free trial of this popular c video course by Kenny Kerr.

In below program, the outer loop is used to get the characters from the encoded string. In each iteration, fetches the characters and increases the index.

The inner loop is used to display the individual characters like an exclamation mark (!) or space (‘ ’). This loop is also asserted new line whenever it reaches the end of the line.

The inner loop is drawn (CharacterAsciValue – 64 ) character and AsciValueNewLine is going from 10 to 90. The value of AsciValueNewLine is reset to 10 when the end of the line is reached.


One comment

Leave a Reply