22

I found this cool C code that prints map of India. But code went straight over my head. It looks cool though!
Here's the code if can explain!!
https://gist.github.com/Deepamgoel/...

Comments
  • 0
    @1989 thanks 😓
  • 5
    If you see in the program there is a variable named str. That has the code stored for map of india. Every character in that str variable represent what to print corresponding to that character to generate map of India
  • 3
    The characters in the string represent how many consecutive ' ' or '!' characters to write. Every character in the string when converted to its ascii code and subtracted 64 from it, gives the number of chars to write. The 'c' variable is used to print the newline characters every 80 characters (standard width of the console). The code is obfuscated but you should see how the c variable goes from 10 to 90 which is the same as 0 to 80. The chars in the string aren't directly reduced by 64 - the condition of the while loop does that. I hope you can understand it now
Add Comment