C Program Code To Print Map of India

Here’s a Code To Print Map of India in C Programming Language using For loop. This program code is an example of Obfuscated Code in C programming language.

Objectives of Obfuscated Code

To create a program code in an unusual way and thereby emphasizing on programming style in an ironic method.

To create a program that resembles images, text and unusual characters that you may think of.

To write the an obscure program code in C programming language which are within the rules of the language.

To force the C compiler to execute with unusual codes and thereby making rarely used code combinations.

To show the importance of programming style, in an ironic way.

To make use of pre-processors which thereby makes the code harder to read.

Note: This code to Print Map of India in C programming has been compiled with GNU GCC compiler and developed using gEdit Editor and Terminal in Linux Ubuntu Terminal Operating System.

Method 1: Code To Print Map of India in C Programming (Obfuscated Code)

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 #include <stdio.h> void main ( ) { int x , y , z ; int c = 1 ; for ( y = z = 10 ; x = "- FIGURE?, UMKC,XYZHello Folks,\ TFy!QJu ROo TNn(ROo)SLq SLq ULo+\ UHs UJq TNn*RPn/QPbEWS_JSWQAIJO^\ NBELPeHBFHT}TnALVlBLOFAkHFOuFETp\ HCStHAUFAgcEAelclcn^r^r\\tZvYxXy\ T|S~Pn SPm SOn TNn ULo0ULo#ULo-W\ Hq!WFs XDt!" [ y ++ + 21 ] ; ) for ( ; x -- > 64 ; ) putchar ( ++ z == 'Z' ? z = z / 9 : 33 ^ y & 1 ) ; }

Method 2: C Program To Display Map of India using For Loop

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 #include <stdio.h> void main ( ) { int x , y , z ; int i = 1 ; for ( y = z = 10 ; x = "- FIGURE?, UMKC,XYZHello Folks,\ TFy!QJu ROo TNn(ROo)SLq SLq ULo+\ UHs UJq TNn*RPn/QPbEWS_JSWQAIJO^\ NBELPeHBFHT}TnALVlBLOFAkHFOuFETp\ HCStHAUFAgcEAelclcn^r^r\\tZvYxXy\ T|S~Pn SPm SOn TNn ULo0ULo#ULo-W\ Hq!WFs XDt!" [ y ++ + 21 ] ; ) for ( ; x -- > 64 ; ) { ++ z ; if ( z == 90 ) { z = 10 ; putchar ( '

' ) ; } else { if ( y % 2 == 0 ) putchar ( '!' ) ; else putchar ( ' ' ) ; } } }

How Does This Obfuscated Version Work?

Basically, the String is a Run Length Encoding of the Image i.e., India’s Map. In the Second Method, we have written putchar() method in a different way which helps to understand the Code even better.

1 2 3 4 5 6 7 for ( y = z = 10 ; x = "- FIGURE?, UMKC,XYZHello Folks,\ TFy!QJu ROo TNn(ROo)SLq SLq ULo+\ UHs UJq TNn*RPn/QPbEWS_JSWQAIJO^\ NBELPeHBFHT}TnALVlBLOFAkHFOuFETp\ HCStHAUFAgcEAelclcn^r^r\\tZvYxXy\ T|S~Pn SPm SOn TNn ULo0ULo#ULo-W\ Hq!WFs XDt!" [ y ++ + 21 ] ; )

Note: The Backslash Character at the end of every line denotes that it is a continuous String. If you miss that character, the program may not work properly.

The String that is defined in multiple lines is actually a Binary Series that is converted to ASCII Values. The String is interpreted as an Array of Characters. Obfuscated Codes are very difficult to understand. The String, therefore, contains the Instructions to Draw India’s Map in C Programming.

The For Loop – for (y = z = 10; x = “…) assigns y with 10 and y+++21. This C Program Code works with Bit Conversion. The Binary 1 is converted into Exclamation (!) and the Binary 0 is converted into a Whitespace ( ) character, thereby printing one character at a given point of time. The String, which is the Run Length Encoding behaves as an Array which makes the start of the data from 31 onwards.

Output

If you have any compilation errors with this C Program to Print Map of India with Obfuscated coding style or if you have any doubts, mention about it in the comment section below.