Re: [algogeeks] Re: debugging contest

2011-03-26 Thread saurabh singh
When you want to use the *infinitely abusable goto statement then you need those labels* On Sat, Mar 26, 2011 at 8:57 PM, Prakash D IT @ CEG wrote: > is there any use with labels xxx, yyy.. ? > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" gr

Re: [algogeeks] Re: debugging contest

2011-03-26 Thread Prakash D IT @ CEG
is there any use with labels xxx, yyy.. ? -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com.

Re: [algogeeks] Re: debugging contest

2011-03-26 Thread balaji a
None of the statements except those inside the 'case' executesaccording to the input, the default case gets executed which is the inner switch which prints nine.. On Wed, Mar 23, 2011 at 8:46 PM, cegprakash wrote: > i=9; >switch(i){ > xxx: printf("default"); >

Re: [algogeeks] Re: debugging contest

2011-03-26 Thread Tushar Bindal
xxx, yyy are considered as cases? -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more

Re: [algogeeks] Re: debugging contest

2011-03-23 Thread saurabh singh
sorry i mean case On Wed, Mar 23, 2011 at 8:49 PM, saurabh singh wrote: > > Write switch and you will get error.They are not treated as labels.Read > about : operator. > > On Wed, Mar 23, 2011 at 8:46 PM, cegprakash wrote: > >> i=9; >>switch(i){ >> xxx: printf("default"); >

[algogeeks] Re: debugging contest

2011-03-23 Thread cegprakash
what is the use of labels in switch -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For mo

Re: [algogeeks] Re: debugging contest

2011-03-23 Thread saurabh singh
Write switch and you will get error.They are not treated as labels.Read about : operator. On Wed, Mar 23, 2011 at 8:46 PM, cegprakash wrote: > i=9; >switch(i){ > xxx: printf("default"); > yyy:printf("hello"); > asdfasdf: printf("why no errors and why

[algogeeks] Re: debugging contest

2011-03-23 Thread cegprakash
i=9; switch(i){ xxx: printf("default"); yyy:printf("hello"); asdfasdf: printf("why no errors and why not printed"); case '1': printf("one"); default: switch(i){ case '1': printf("one"); break;

Re: [algogeeks] Re: debugging contest

2011-03-23 Thread jagannath prasad das
ascii values da...not 9 On Wed, Mar 23, 2011 at 8:39 PM, saurabh singh wrote: > @cegprakash Relax shut down your computer for some time and switch on your > i-pod.:) > > On Wed, Mar 23, 2011 at 8:39 PM, saurabh singh wrote: > >> @cegprakash Relax shut down your computer for some time and

Re: [algogeeks] Re: debugging contest

2011-03-23 Thread saurabh singh
@cegprakash Relax shut down your computer for some time and switch on your i-pod.:) On Wed, Mar 23, 2011 at 8:39 PM, saurabh singh wrote: > @cegprakash Relax shut down your computer for some time and switch on your > i-pod.:) > > > > On Wed, Mar 23, 2011 at 8:37 PM, cegprakash wrote: >

Re: [algogeeks] Re: debugging contest

2011-03-23 Thread saurabh singh
@cegprakash Relax shut down your computer for some time and switch on your i-pod.:) On Wed, Mar 23, 2011 at 8:37 PM, cegprakash wrote: > now i got it.. first it checks whether it matches with any case. If it > matches it starts executing from that case until it encounters a > break. > if it

Re: [algogeeks] Re: debugging contest

2011-03-23 Thread Shalini Sah
now the case 9 is matching so it gets executed...n da break statement is encountered... On Wed, Mar 23, 2011 at 8:35 PM, cegprakash wrote: > >i=9; >switch(i){ > default: printf("default"); > case 9: printf("one"); break; > case '2': printf("two");

[algogeeks] Re: debugging contest

2011-03-23 Thread cegprakash
now i got it.. first it checks whether it matches with any case. If it matches it starts executing from that case until it encounters a break. if it doesn't matches with any case then it starts executing from default and starts executing until a break. -- You received this message because you are

[algogeeks] Re: debugging contest

2011-03-23 Thread cegprakash
i=9; switch(i){ default: printf("default"); case 9: printf("one"); break; case '2': printf("two"); break; case '9': printf("nine"); break; } but how the hell we get output for the above code as "one" .. why "default" not pri

Re: [algogeeks] Re: debugging contest

2011-03-23 Thread Shalini Sah
ryt..since none of the cases match so default case is executed,..but since u havnt placed break aftr dat..case '1' too gets executed..evn if u didnt intend to do so..dats y da output "defaultone" On Wed, Mar 23, 2011 at 8:31 PM, cegprakash wrote: > i is not equal to '1' > i=1 which is equialent

[algogeeks] Re: debugging contest

2011-03-23 Thread cegprakash
sorry i meant '1'=49 and 9 is not 49 but how we get "one" -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@go

[algogeeks] Re: debugging contest

2011-03-23 Thread cegprakash
i is not equal to '1' i=1 which is equialent to 49 -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegro

Re: [algogeeks] Re: debugging contest

2011-03-23 Thread saurabh singh
bcoz '9'!=9.Anything within ' '(single quotes) is a character and not int On Wed, Mar 23, 2011 at 8:27 PM, cegprakash wrote: > why do i get "one" after "default"? > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this g

Re: [algogeeks] Re: debugging contest

2011-03-23 Thread Shalini Sah
since u havnt written da break statement...the case '1' also gets executed..and then when the break statement is encountered..the control comes out of the switch case On Wed, Mar 23, 2011 at 8:27 PM, cegprakash wrote: > why do i get "one" after "default"? > > -- > You received this message beca

[algogeeks] Re: debugging contest

2011-03-23 Thread cegprakash
why do i get "one" after "default"? -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For mo