Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

please explain the for loop

Posted on 2006-07-17
4
Medium Priority
?
325 Views
Last Modified: 2010-04-15
Can anyone please explain the below code...

#include<stdio.h>
main()
{ int a,b,c;
int count = 1;

for (b=c=10;a="- 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!" [b+++21]; )

for(; a-- > 64 ; ) putchar ( ++c=='Z' ? c = c/ 9:33^b&1);
return 0; }
0
Comment
Question by:Suhas .
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 8

Expert Comment

by:manish_regmi
ID: 17121184
hmm, a similar q was posted about a year ago (i forgot the link). That draw the picture using characters. I hope this does something similar.

ok, it  draws i pic just uses '!'. Some creative programmer might have created it. :)

regards
Manish Regmi

0
 
LVL 8

Assisted Solution

by:manish_regmi
manish_regmi earned 200 total points
ID: 17121207
ok its here. Looks like same algo

http://www.experts-exchange.com/Programming/Programming_Languages/C/Q_20711665.html


regards
Manish regmi
0
 
LVL 22

Accepted Solution

by:
grg99 earned 300 total points
ID: 17121248
Simple:     :)


#include<stdio.h>   //you figure this one out
main()   // we have a program
{ int a,b,c;   /with three int variables
int count = 1;   // and "count"

for (
    b=c=10;   //intilize b and c to 10

a="- 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!" [b+++21];  // set a to the 31st chartacter of that long quoted string, quit looping when we fall off the end
 )

for(;
 a-- > 64 ;   /  'A' is 64, so count down the letter we got above til we get down to 'A'

 ) putchar (    // print whatever the expression evaluates to.
    ++c=='Z'    // remember we set c to 10?  count it up til it hits 'Z' (90)
    ? c = c/ 9    // when it hits 90, reset it back to 10   (90/9)  and print 10 (LINE FEED)
     : 33^b&1     //   otherwise (before 90)  b anded with 1 gives alternatiing 0 and 1) xor with 33 and
                        // it will  print either 32 (space) or (33) asterisk.);
return 0; }


// so basically it prints alternating runs of spaces and asterisks, with a line feed every 80 characters.

0
 
LVL 11

Expert Comment

by:cup
ID: 17125962
Possibly based on the stuff from the obfuscated C competition.  If you wish to  to have a look at more complex examples.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
The goal of this video is to provide viewers with basic examples to understand and use pointers in the C programming language.
The goal of this video is to provide viewers with basic examples to understand recursion in the C programming language.

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question