Re: [algogeeks] output

2013-12-09 Thread Tamanna Afroze
i think because of &operator the program is working differently... also there is four data value print operation.. On Mon, Dec 9, 2013 at 2:34 AM, Tamanna Afroze wrote: > I got some other outputs.. when line 6 isn't commented i got 3 1 2 3, i m > using turbo c++ compiler.. > > > On Fri, Dec 6,

Re: [algogeeks] output

2013-12-09 Thread Tamanna Afroze
I got some other outputs.. when line 6 isn't commented i got 3 1 2 3, i m using turbo c++ compiler.. On Fri, Dec 6, 2013 at 8:17 AM, pawan yadav wrote: > Hi All, > > I'm not able to get output of following c program : > > #include > main() > { > int a[] ={ 1,2,3,4,5,6,7}; > char c[]

Re: [algogeeks] Output

2012-11-24 Thread Rushiraj Patel
As arithmetic operator has higher precedence than shifting operator , mask will have 5th bit zero from left. So it will deduct 16 from the input if 5th bit is set in the binary representation of number. so it will deduct 16 from 56 and 127..but not from 64 But its just the proced

Re: [algogeeks] output of the program with explanation

2012-11-07 Thread vishwa
let me keep it simple y is integer pointer pointing to address 20 .. x=20 y+7 will point to the addressy + ( size(int) * 7) i.e 50 here /*y is integer pointer*/ On Tue, Nov 6, 2012 at 11:45 AM, Rahul Kumar Patle < patlerahulku...@gmail.com> wrote: > because difference is of 30 byt

Re: Re: [algogeeks] output of the program with explanation

2012-11-06 Thread rajesh . pandey . iiit
@rahul thnx !!! On , rahul patil wrote: its because it is integer pointer subtraction, So subtraction result will be divided by integer size. so 30/4 = 7. 2012/11/6 rajesh pandey rajesh.pandey.i...@gmail.com> int *x ,int *y; x=(int *) 50; y=(int *)20; cout why the output is 7.

Re: [algogeeks] output of the program with explanation

2012-11-05 Thread rahul patil
its because it is integer pointer subtraction, So subtraction result will be divided by integer size. so 30/4 = 7. 2012/11/6 rajesh pandey > *int *x ,int *y; > x=(int *) 50; > y=(int *)20; > cout< > why the output is 7.* > > -- > You received this message because you are subscribed to the Goo

Re: [algogeeks] output C

2012-02-25 Thread atul anand
0001, 0010, 0100, these number are represented in octal ..so u r getting decimal of the same. 1000 -> this is a decimal value; preceding number by "0" means you are representing it in octal format similarly preceding "0x" means representing in hexa format. On Sun, Feb 26, 2012 at 3:38 AM, Rav

Re: [algogeeks] output expalnation?

2011-09-26 Thread Ratan
On ideone.com its showing compiler error and on ubuntu garbage value of b gets as the result... On Tue, Sep 27, 2011 at 10:21 AM, gaurav yadav wrote: > b=6 will not execute.. > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To pos

Re: [algogeeks] output expalnation?

2011-09-26 Thread gaurav yadav
b=6 will not execute.. -- 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 options, v

Re: [algogeeks] output expalnation?

2011-09-26 Thread sukran dhawan
compile time error... except case labels nothing else will be executed in case of switch statements... so definition of b will not be executed.so compilation error On Tue, Sep 27, 2011 at 6:28 AM, Ratan wrote: > #include > int main() > { >int a=1; >switch(a) >{ >

Re: [algogeeks] output

2011-09-13 Thread Kunal Patil
@Kumar: +1 @Kumar & Rajeshwar: ExitFailure is outputted because main is expected to return something which is not done in your case. Just add return 0; at the end of main to get expected output. On Tue, Sep 13, 2011 at 11:33 PM, Ishan Aggarwal < ishan.aggarwal.1...@gmail.com> wrote: > int main()

Re: [algogeeks] output

2011-09-13 Thread Ishan Aggarwal
int main(){printf("%s",printf("samsung")+fun());return 0;}fun(){return "electronic";} On Tue, Sep 13, 2011 at 11:28 PM, kumar raja wrote: > main(){printf("%s",printf("samsung")+fun());}fun(){return "electronic";} > > The printf is a function which returns the number of printed characters , and

Re: [algogeeks] output

2011-09-13 Thread kumar raja
main(){printf("%s",printf("samsung")+fun());}fun(){return "electronic";} The printf is a function which returns the number of printed characters , and scanf is a function which returns the number of inputs scanned . So after printing "samsung" it returns 7. fun() is returning a pointer to the con

Re: [algogeeks] Output question

2011-08-22 Thread Abhishek
+1 to sagar. @vartika: if you don't know the concept of Union then understanding this program will be quite lenghty, because it will involve lot of calculation. try to check some simple examples, like: union a { int a; char c; }; int main() { union a xy; xy.a=65; printf("%c",xy.c)

Re: [algogeeks] Output question

2011-08-22 Thread sagar pareek
U should know that union's elements share memory alloted through the largest data type like in this case 10 bytes is alloted and is shared by all the union elements. So in union x :- last element modified is c, so that's why it is printing garbage values for int and char[] elements... actually if

Re: [algogeeks] output

2011-08-12 Thread Anil Arya
Answer=:> 32 On Fri, Aug 12, 2011 at 8:05 PM, Avenged wrote: > this is the question : > > #include > #define prn(a) printf("%d",a) > #define print(a,b,c) prn(a), prn(b), prn(c) > #define max(a,b) (a>b?a:b) > > int main() > { > int x=1, y=2; > print(max(x++,y),x,y); > print(max(x++,y),x,y);

Re: [algogeeks] output

2011-08-12 Thread Avenged
this is the question : #include #define prn(a) printf("%d",a) #define print(a,b,c) prn(a), prn(b), prn(c) #define max(a,b) (a>b?a:b) int main() { int x=1, y=2; print(max(x++,y),x,y); print(max(x++,y),x,y); return 0; } -- You received this message because you are subscribed to the Google Groups

Re: [algogeeks] output

2011-08-12 Thread sukran dhawan
macro has not been terminated and it has so many errors On Thu, Aug 11, 2011 at 11:36 PM, manvir siyo wrote: > output of the program? > > #define prn(a) printf("%d",a) > #define print(a,b,c) prn(a), prn(b), prn(c) > #define max(a,b) (a > > main() > { > int x=1, y=2; > print(max(x++,y),x,y); > p

Re: [algogeeks] output

2011-08-11 Thread mani walia
this is the question in de shaw written test On Thu, Aug 11, 2011 at 11:48 PM, Anika Jain wrote: > this code has so many errors > > On Thu, Aug 11, 2011 at 11:36 PM, manvir siyo wrote: > >> output of the program? >> >> #define prn(a) printf("%d",a) >> #define print(a,b,c) prn(a), prn(b), prn(c

Re: [algogeeks] output

2011-08-11 Thread Anika Jain
this code has so many errors On Thu, Aug 11, 2011 at 11:36 PM, manvir siyo wrote: > output of the program? > > #define prn(a) printf("%d",a) > #define print(a,b,c) prn(a), prn(b), prn(c) > #define max(a,b) (a > > main() > { > int x=1, y=2; > print(max(x++,y),x,y); > print(max(x++,y),x,y); > } >

Re: [algogeeks] output?

2011-08-10 Thread Arun Vishwanathan
@sandeep: so the statement becomes if(ch=0) since printf returns integer 0...whats does this mean now actually?0 is ascii for NULL and so ch is assinged to null? I am slightly confused.. On Tue, Aug 9, 2011 at 7:04 PM, SANDEEP CHUGH wrote: > @all sorry i give wrong explanation by mistake..:P :P >

Re: [algogeeks] output?

2011-08-09 Thread SANDEEP CHUGH
@all sorry i give wrong explanation by mistake..:P :P printf("") returns no if characters.. in this case returns 0 . which is assigned to ch so in ch 0 is stored and 0 is the ascii value of null character when we using ch in --- if (ch) --> it will reduce to if(0) -- as 0 is the ascii value of n

Re: [algogeeks] output?

2011-08-09 Thread siddharth srivastava
my bad..that I didn't notice = (assumed it to be ==) On 9 August 2011 22:28, SANDEEP CHUGH wrote: > it doesn't matter > > On Tue, Aug 9, 2011 at 10:25 PM, siddharth srivastava > wrote: > >> >> >> On 9 August 2011 22:20, tech rascal wrote: >> >>> #include >>> int main() >>> { >>> char ch; >>> i

Re: [algogeeks] output?

2011-08-09 Thread SANDEEP CHUGH
it doesn't matter On Tue, Aug 9, 2011 at 10:25 PM, siddharth srivastava wrote: > > > On 9 August 2011 22:20, tech rascal wrote: > >> #include >> int main() >> { >> char ch; >> if((ch=printf(""))) >> printf("it matters"); >> else >> printf("it doesn't matter"); >> return 0; >> } >> >> > output wu

Re: [algogeeks] output?

2011-08-09 Thread Dipankar Patro
o/p: It doesn't matter Reason: printf() returns the number of characters printed to screen. since printf("") will return 0, hence the *else* is selected. On 9 August 2011 22:25, siddharth srivastava wrote: > > > On 9 August 2011 22:20, tech rascal wrote: > >> #include >> int main() >> { >> cha

Re: [algogeeks] output?

2011-08-09 Thread Amol Sharma
printf returns the numbers of character printed and here it prints nothing i.e. 0 characters hence returns 0 and hence "it doesnt matter" gets printed -- Amol Sharma Third Year Student Computer Science and Engineering MNNIT Allahabad On Tue, Aug 9, 2011 at 10:25 PM, tech rascal wrote: > exp

Re: [algogeeks] output?

2011-08-09 Thread siddharth srivastava
On 9 August 2011 22:25, tech rascal wrote: > explanation?? > > printf returns the no of characters printed moreover you have an uninitialized char (with garbage value) so comparison will always be false > > On Tue, Aug 9, 2011 at 10:24 PM, aditi garg wrote: > >> it doesnt matter >> >> On Tue,

Re: [algogeeks] output?

2011-08-09 Thread Varun Jakhoria
it doesn't matter On Tue, Aug 9, 2011 at 10:24 PM, Jayanthi shravan wrote: > >   it matters.. > On Tue, Aug 9, 2011 at 10:20 PM, tech rascal > wrote: >> >> >> >> what will b the output?? >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" gr

Re: [algogeeks] output?

2011-08-09 Thread siddharth srivastava
On 9 August 2011 22:20, tech rascal wrote: > #include > int main() > { > char ch; > if((ch=printf(""))) > printf("it matters"); > else > printf("it doesn't matter"); > return 0; > } > > It doesn't matter > > what will b the output?? > > -- > You received this message because you are subscribed

Re: [algogeeks] output?

2011-08-09 Thread tech rascal
explanation?? On Tue, Aug 9, 2011 at 10:24 PM, aditi garg wrote: > it doesnt matter > > On Tue, Aug 9, 2011 at 10:20 PM, tech rascal wrote: > >> #include >> int main() >> { >> char ch; >> if((ch=printf(""))) >> printf("it matters"); >> else >> printf("it doesn't matter"); >> return 0; >> } >> >>

Re: [algogeeks] output?

2011-08-09 Thread Jayanthi shravan
it matters.. On Tue, Aug 9, 2011 at 10:20 PM, tech rascal wrote: > > > > what will b the output?? > > -- > 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

Re: [algogeeks] output?

2011-08-09 Thread aditi garg
it doesnt matter On Tue, Aug 9, 2011 at 10:20 PM, tech rascal wrote: > #include > int main() > { > char ch; > if((ch=printf(""))) > printf("it matters"); > else > printf("it doesn't matter"); > return 0; > } > > > what will b the output?? > > -- > You received this message because you are subscri

Re: [algogeeks] output help

2011-08-09 Thread SANDEEP CHUGH
i dnt get it.. any better explanation.. On Tue, Aug 9, 2011 at 1:13 PM, dinesh bansal wrote: > On a little-endian machine, bit structure will be represented as: > > 0x00 00 00 45 > > which is bit.bit4 = 0010 (2 in decimal) bit.bit3 = 0010 (2 in decimal) > bit.bit1 = 1 (1 in decimal) > > since b

Re: [algogeeks] output help

2011-08-09 Thread dinesh bansal
On a little-endian machine, bit structure will be represented as: 0x00 00 00 45 which is bit.bit4 = 0010 (2 in decimal) bit.bit3 = 0010 (2 in decimal) bit.bit1 = 1 (1 in decimal) since bit.bit1 exists at the rightmost position, while displaying data as integer, compiler just repeats the same bi

Re: [algogeeks] output help

2011-08-09 Thread Rohit Srivastava
hey guys thanks got it!! On Tue, Aug 9, 2011 at 12:49 PM, sanjay ahuja wrote: > Int bit3:4 will be read as lower order 4 bits of bit3 and this will be > treated as int (signed). Thus lower order bit of bit3 which is 2, are > 0010 which is 2 > try with > 1) int bit3:2, output will be -2 > 2)

Re: [algogeeks] output help

2011-08-09 Thread sanjay ahuja
Int bit3:4 will be read as lower order 4 bits of bit3 and this will be treated as int (signed). Thus lower order bit of bit3 which is 2, are 0010 which is 2 try with 1) int bit3:2, output will be -2 2) unsigned int bit3:2, output will be 2. I hope it is cleared now On 8/9/11, Rohit Srivastava wr

Re: [algogeeks] output help

2011-08-09 Thread aditi garg
I think it is because bit1 is only 1 bit fwide and whn u initialize it to 1,since MSB is 1 it treats it as a negative integer...Plz correct me if i am wrong... On Tue, Aug 9, 2011 at 12:24 PM, Rohit Srivastava wrote: > #include > #include > > int main() > { > struct value > { > in

Re: [algogeeks] output help

2011-08-07 Thread Kamakshii Aggarwal
got it...thanks On Mon, Aug 8, 2011 at 12:39 AM, aseem garg wrote: > typedef doesn't declare an instance of a variable, it declares a type (type > alias actually), > > static is a qualifier you apply to an instance, not a type, so you can use > static when you use the type, but not when you defi

Re: [algogeeks] output help

2011-08-07 Thread aseem garg
typedef doesn't declare an instance of a variable, it declares a type (type alias actually), static is a qualifier you apply to an instance, not a type, so you can use static when you use the type, but not when you define the type. Aseem On Mon, Aug 8, 2011 at 12:29 AM, Kamakshii Aggarwal wrote

Re: [algogeeks] output help

2011-08-07 Thread Amol Sharma
using typedef u define the static keyword as int and the statement static int j thus becomes int int j hence the compiler gives the error "multiple storage class in declaration specifiers" -- Amol Sharma Third Year Student Computer Science and Engineering MNNIT Allahabad On Mon, Aug 8, 2011

Re: [algogeeks] OUTPUT????

2011-08-06 Thread Aditya Virmani
output wud be: 0.00 float value= 00.0 integer value=1 1 1 1 0.00 On Sat, Aug 6, 2011 at 2:49 PM, SHIVAM AGRAWAL wrote: > any1 plz tell me y output of float type of dis prgrm is zero? > > #include > #define INT 1 > main() > { > struct a > { > int type; >

Re: [algogeeks] OUTPUT????

2011-08-06 Thread Ankit Minglani
out put is : 10.375001 float value =10.4 integer value=1 1 1 1 10.37500 what us the problem ? On Sat, Aug 6, 2011 at 2:19 AM, SHIVAM AGRAWAL wrote: > any1 plz tell me y output of float type of dis prgrm is zero? > > #include > #define INT 1 > main() > { > struct a > { >

Re: [algogeeks] output

2011-08-05 Thread Pramod Jayswal
when swap is called ,as it is a macro ,before compilation its code is replaced and the code before compilation bcomes: > # define swap(a,b) temp=a; a=b; b=temp; > main( ) > { > int i, j, temp; > i=5; > j=10; > temp=0; > if( i > j) > //code replaced here > temp=a; //not executed (false) >

Re: [algogeeks] output

2011-08-05 Thread loka ranjane
@saurabh:ya got it..thanks On Sat, Aug 6, 2011 at 10:26 AM, saurabh singh wrote: > Try compiling with gcc -E .That will clear everything > > On Sat, Aug 6, 2011 at 10:25 AM, saurabh singh wrote: >> >> hint:MACRo is just substituted as it is >> >> On Sat, Aug 6, 2011 at 10:23 AM, ranjane

Re: [algogeeks] output

2011-08-05 Thread sagar pareek
Lets see what happen with ur code... original # define swap(a,b) temp=a; a=b; b=temp; main( ) { int i, j, temp; i=5; j=10; temp=0; if( i > j) swap( i, j ); printf( “%d %d %d”, i, j, temp); } after expansion of macro # define swap(a,b) temp=a; a=b; b=temp; main( ) { int i, j, temp; i=5; j=10; te

Re: [algogeeks] output

2011-08-05 Thread saurabh singh
Try compiling with gcc -E .That will clear everything On Sat, Aug 6, 2011 at 10:25 AM, saurabh singh wrote: > hint:MACRo is just substituted as it is > > > On Sat, Aug 6, 2011 at 10:23 AM, ranjane wrote: > >> # define swap(a,b) temp=a; a=b; b=temp; >> main( ) >> { >> int i, j, temp; >>

Re: [algogeeks] output

2011-08-05 Thread saurabh singh
hint:MACRo is just substituted as it is On Sat, Aug 6, 2011 at 10:23 AM, ranjane wrote: > # define swap(a,b) temp=a; a=b; b=temp; > main( ) > { > int i, j, temp; > i=5; > j=10; > temp=0; > if( i > j) > swap( i, j ); > printf( “%d %d %d”, i, j, temp); > } > > > On compiling i got ans 10, 0, 0

Re: [algogeeks] output???

2011-08-05 Thread sagar pareek
ha ha its not like it stores slightly less than actual :P :P try this float a=0.5,b=1.0,c=0.7; if(0.5==a) printf("yes a=0.5\n"); if(1.0==b) printf("yes b=1.0\n"); if(0.7!=c) printf("Yes c!=0.7\n"); o/p will be yes a=0.5 yes b=1.0 yes c!=0.7 check it out i will explain it later... On Fri, Au

Re: [algogeeks] output???

2011-08-05 Thread Rajesh Kumar
Thanks to all On Fri, Aug 5, 2011 at 8:53 PM, sukran dhawan wrote: > coz by default all real values are converted to double and it is larger > than float.ie real nos are not stored accurately inside computer memory.so > since double occupies more memory it prints hi > > > On Fri, Aug 5, 2011 at 8

Re: [algogeeks] output???

2011-08-05 Thread sukran dhawan
coz by default all real values are converted to double and it is larger than float.ie real nos are not stored accurately inside computer memory.so since double occupies more memory it prints hi On Fri, Aug 5, 2011 at 8:24 PM, Kamakshii Aggarwal wrote: > the reason is dat 0.7 is treated as double.

Re: [algogeeks] output???

2011-08-05 Thread Kamakshii Aggarwal
the reason is dat 0.7 is treated as double..therefore double(0.7) >float(0.7) On Fri, Aug 5, 2011 at 8:20 PM, kartik sachan wrote: > the output will be hi > > even if u have putted equal to sign there this is becoz 0.7 do not exactly > stored like 0.7 in a but some thing lesser as describe in ASC

Re: [algogeeks] output???

2011-08-05 Thread bagaria.ka...@gmail.com
.7 in float is taken like .699 i blv ? On Fri, Aug 5, 2011 at 8:20 PM, kartik sachan wrote: > the output will be hi > > even if u have putted equal to sign there this is becoz 0.7 do not exactly > stored like 0.7 in a but some thing lesser as describe in ASCII format > that's why it is awlays

Re: [algogeeks] output???

2011-08-05 Thread kartik sachan
the output will be hi even if u have putted equal to sign there this is becoz 0.7 do not exactly stored like 0.7 in a but some thing lesser as describe in ASCII format that's why it is awlays lesser than 0.7 -- You received this message because you are subscribed to the Google Groups "Algorithm

Re: [algogeeks] Output Help.

2011-07-30 Thread gaurav gupta
thanx kamakshi On Sun, Jul 31, 2011 at 1:56 AM, Kamakshii Aggarwal wrote: > @gaurav:refer the link below > http://c-faq.com/expr/seqpoints.html > > > On Sun, Jul 31, 2011 at 1:53 AM, gaurav gupta wrote: > >> bt y it sud b undefind? >> >> >> On Sun, Jul 31, 2011 at 1:51 AM, Sanchit Manchanda >> w

Re: [algogeeks] Output Help.

2011-07-30 Thread Kamakshii Aggarwal
@gaurav:refer the link below http://c-faq.com/expr/seqpoints.html On Sun, Jul 31, 2011 at 1:53 AM, gaurav gupta wrote: > bt y it sud b undefind? > > > On Sun, Jul 31, 2011 at 1:51 AM, Sanchit Manchanda > wrote: > >> I dint get any error, not even warning. it might depend from compiler to >> com

Re: [algogeeks] Output Help.

2011-07-30 Thread gaurav gupta
bt y it sud b undefind? On Sun, Jul 31, 2011 at 1:51 AM, Sanchit Manchanda wrote: > I dint get any error, not even warning. it might depend from compiler to > compiler. but yeah it should be undefined. > > > On Sun, Jul 31, 2011 at 1:49 AM, Kamakshii Aggarwal > wrote: > >> @sanchit:it is undefin

Re: [algogeeks] Output Help.

2011-07-30 Thread Sanchit Manchanda
I dint get any error, not even warning. it might depend from compiler to compiler. but yeah it should be undefined. On Sun, Jul 31, 2011 at 1:49 AM, Kamakshii Aggarwal wrote: > @sanchit:it is undefined.. > > > On Sun, Jul 31, 2011 at 1:47 AM, Sanchit Manchanda > wrote: > >> I am getting b=2. >>

Re: [algogeeks] Output Help.

2011-07-30 Thread Kamakshii Aggarwal
@sanchit:it is undefined.. On Sun, Jul 31, 2011 at 1:47 AM, Sanchit Manchanda wrote: > I am getting b=2. > Maybe coz we are assigning 2 to b then incrementing b. But still acc to me > it should be 3. > :-\ > No warnings in dev cpp. > > > > On Sun, Jul 31, 2011 at 1:43 AM, Amol Sharma wrote: > >>

Re: [algogeeks] Output Help.

2011-07-30 Thread Sanchit Manchanda
I am getting b=2. Maybe coz we are assigning 2 to b then incrementing b. But still acc to me it should be 3. :-\ No warnings in dev cpp. On Sun, Jul 31, 2011 at 1:43 AM, Amol Sharma wrote: > yup it is undefined and the warning is justified > b=b++ will assign 2 to b then increment b hence 3 is

Re: [algogeeks] Output Help.

2011-07-30 Thread Amol Sharma
yup it is undefined and the warning is justified b=b++ will assign 2 to b then increment b hence 3 is printed -- Amol Sharma Third Year Student Computer Science and Engineering MNNIT Allahabad On Sun, Jul 31, 2011 at 1:41 AM, Neeraj Gupta wrote: > Yes, it's UB. > For such ques, try to run it

Re: [algogeeks] Output Help.

2011-07-30 Thread aseem garg
On Dev CPP. Aseem On Sun, Jul 31, 2011 at 1:42 AM, aseem garg wrote: > I am getting 2. >.< > Aseem > > > > On Sun, Jul 31, 2011 at 1:41 AM, Neeraj Gupta > wrote: > >> Yes, it's UB. >> For such ques, try to run it on ideone. >> It will give a warning if any operation is not standard. >> http:/

Re: [algogeeks] Output Help.

2011-07-30 Thread aseem garg
I am getting 2. >.< Aseem On Sun, Jul 31, 2011 at 1:41 AM, Neeraj Gupta wrote: > Yes, it's UB. > For such ques, try to run it on ideone. > It will give a warning if any operation is not standard. > http://ideone.com/bJBGl > > > > On Sun, Jul 31, 2011 at 1:38 AM, aditi

Re: [algogeeks] Output Help.

2011-07-30 Thread Neeraj Gupta
Yes, it's UB. For such ques, try to run it on ideone. It will give a warning if any operation is not standard. http://ideone.com/bJBGl On Sun, Jul 31, 2011 at 1:38 AM, aditi garg wrote: > it would be undefined... > > On Sun, Jul 31, 2011 at 1:34 AM, Kamakshii Aggarwal

Re: [algogeeks] Output Help.

2011-07-30 Thread vidushi
@aseem its 3 different on yours ? On Sun, Jul 31, 2011 at 1:37 AM, aseem garg wrote: > @Kamakshi: Run karke dekh leti pehle. :-/ > Aseem > > > > On Sun, Jul 31, 2011 at 1:34 AM, Kamakshii Aggarwal > wrote: > >> 3.it is same as b=b+1; >> >> On Sun, Jul 31, 2011 at 1:32 AM, aseem garg wrote: >>

Re: [algogeeks] Output Help.

2011-07-30 Thread Amol Sharma
@aseem output is 3 only...check it once again http://ideone.com/mWGc5 -- Amol Sharma Third Year Student Computer Science and Engineering MNNIT Allahabad On Sun, Jul 31, 2011 at 1:37 AM, aseem garg wrote: > @Kamakshi: Run karke dekh leti pehle. :-/ > Aseem > > > > On Sun, Jul 31, 2011 at

Re: [algogeeks] Output Help.

2011-07-30 Thread vaibhav shukla
concept of sequence points.search wiki On Sun, Jul 31, 2011 at 1:38 AM, aditi garg wrote: > it would be undefined... > > On Sun, Jul 31, 2011 at 1:34 AM, Kamakshii Aggarwal > wrote: > >> 3.it is same as b=b+1; >> >> >> On Sun, Jul 31, 2011 at 1:32 AM, aseem garg wrote: >> >>> int b=2;b=b++;

Re: [algogeeks] Output Help.

2011-07-30 Thread aseem garg
@Aditi: Run karke dekh leti pehle. :-/ Aseem On Sun, Jul 31, 2011 at 1:38 AM, aditi garg wrote: > it would be undefined... > > On Sun, Jul 31, 2011 at 1:34 AM, Kamakshii Aggarwal > wrote: > >> 3.it is same as b=b+1; >> >> >> On Sun, Jul 31, 2011 at 1:32 AM, aseem garg wrote: >> >>> int b=2;b

Re: [algogeeks] Output Help.

2011-07-30 Thread Kamakshii Aggarwal
oh sorry,mane galat pad lia..mane sirf b++ dekha... it is compiler dependent.value of b is changing twice b/w two serial points On Sun, Jul 31, 2011 at 1:37 AM, aseem garg wrote: > @Kamakshi: Run karke dekh leti pehle. :-/ > Aseem > > > > On Sun, Jul 31, 2011 at 1:34 AM, Kamakshii Aggarwal > w

Re: [algogeeks] Output Help.

2011-07-30 Thread aditi garg
it would be undefined... On Sun, Jul 31, 2011 at 1:34 AM, Kamakshii Aggarwal wrote: > 3.it is same as b=b+1; > > > On Sun, Jul 31, 2011 at 1:32 AM, aseem garg wrote: > >> int b=2;b=b++; >> b=??? >> >> Plz explain.. >> Aseem >> >> -- >> You received this message because you are subscribed to the

Re: [algogeeks] Output Help.

2011-07-30 Thread aseem garg
@Kamakshi: Run karke dekh leti pehle. :-/ Aseem On Sun, Jul 31, 2011 at 1:34 AM, Kamakshii Aggarwal wrote: > 3.it is same as b=b+1; > > On Sun, Jul 31, 2011 at 1:32 AM, aseem garg wrote: > >> int b=2;b=b++; >> b=??? >> >> Plz explain.. >> Aseem >> >> -- >> You received this message because y

Re: [algogeeks] Output Help.

2011-07-30 Thread Kamakshii Aggarwal
3.it is same as b=b+1; On Sun, Jul 31, 2011 at 1:32 AM, aseem garg wrote: > int b=2;b=b++; > b=??? > > Plz explain.. > Aseem > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algogeeks@googlegroup

Re: [algogeeks] OUTPUT PROBLEM

2011-07-30 Thread kartik sachan
*@AMOL *sending a normal pointer to a const pointer doesn't give any warning why this is giving?? -- 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 gro

Re: [algogeeks] OUTPUT PROBLEM

2011-07-30 Thread Amol Sharma
the warning comes is as warning: passing argument 1 of ‘foo’ from incompatible pointer type foo expects a constant char** but it is not the case...hence warning is displayed... remove the const keyword.you'll see no warning !! -- Amol Sharma Third Year Student Computer Science and En

Re: [algogeeks] output

2011-07-27 Thread Kamakshii Aggarwal
@piyush:thanks...i got my mistake On Wed, Jul 27, 2011 at 7:30 PM, Piyush Sinha wrote: > char const *s and const char *s are both same...try using char *const s..it > will give error then > > > On Wed, Jul 27, 2011 at 7:21 PM, Kamakshii Aggarwal > wrote: > >> @magesh:so acc to you the code below

Re: [algogeeks] output

2011-07-27 Thread mageshthegreat
Sorry between * and the variable name. Sent from BlackBerry® on Airtel -Original Message- From: Kamakshii Aggarwal Sender: algogeeks@googlegroups.com Date: Wed, 27 Jul 2011 19:21:13 To: Reply-To: algogeeks@googlegroups.com Subject: Re: [algogeeks] output @magesh:so acc to you the code

Re: [algogeeks] output

2011-07-27 Thread Piyush Sinha
char const *s and const char *s are both same...try using char *const s..it will give error then On Wed, Jul 27, 2011 at 7:21 PM, Kamakshii Aggarwal wrote: > @magesh:so acc to you the code below should give error? > #include > > int main(int argc,char *argv[]) > { > char const *s=""; > char st

Re: [algogeeks] output

2011-07-27 Thread Kamakshii Aggarwal
@magesh:so acc to you the code below should give error? #include int main(int argc,char *argv[]) { char const *s=""; char str[]="hello"; s=str; while(*s){ printf("%c",*s++); } system("pause"); return 0; } On Wed, Jul 27, 2011 at 7:12 PM, wrote: > ** Its not a co

Re: [algogeeks] output

2011-07-27 Thread mageshthegreat
Its not a const pointer. It is pointer to constant. So only modifying the value of s will cause error. For constant to pointer the const has to be between * and the keyword Sent from BlackBerry® on Airtel -Original Message- From: Kamakshii Aggarwal Sender: algogeeks@googlegroups.com Dat

Re: [algogeeks] OUTPUT

2011-07-27 Thread ramya reddy
The system on which u executed this will allocate 4 bytes for int type. hence sizeof(p) gives 4 bytes and sizeof(*p) will contain 4 such integer pointers( int *p[4] is the declaration) which gives 4*4=16 bytes Regards Ramya *Try to learn something about everything and everything about somet

Re: [algogeeks] OUTPUT

2011-07-26 Thread kavitha nk
sry sry o/p ll be 0 1 0in the 2nd printf the value ll be evaluated from rite to left... so in the 1st printf i's vlue ll be 0 and in the 2nd printf stmt rite expression is evaluated first and then i value ll be modified in it.. and with hte help of it left one is evaluated...crct me if i'm wron

Re: [algogeeks] OUTPUT

2011-07-25 Thread Puneet Gautam
@aditi: the "%2" in each of these printf statements is redundant coz it is "1%2"...and "%" has higher precedence over left or right shifts..thats y output of say : #include main() { int i=1; printf("\n%d%d ",i<<=2,i<<=1%2); return 0; } is 8 8 1 gets left shifted twice in i<<=2, becomes 4 then i<

Re: [algogeeks] OUTPUT

2011-07-25 Thread Puneet Gautam
@rajeev: hey...does printf evaluate an expression right to left without considering any priority of operators..? Pls reply asap.. On 7/25/11, Puneet Gautam wrote: > @aditi: y dont u try it out urself considering the priorities of > different operators used here...!! > that would help... > > On

Re: [algogeeks] OUTPUT

2011-07-25 Thread rajeev bharshetty
@Ambika Clearly its compiler dependent , My explanation was for gcc 4.3.2 , So it Depends!!1 On Tue, Jul 26, 2011 at 7:03 AM, ambika iyer wrote: > @rajeev : in dev cpp the output is coming as 8 2 for the 2nd code :( y > is tat so??? > > > On Mon, Jul 25, 2011 at 11:30 PM, aditi garg wrote: >

Re: [algogeeks] OUTPUT

2011-07-25 Thread ambika iyer
@rajeev : in dev cpp the output is coming as 8 2 for the 2nd code :( y is tat so??? On Mon, Jul 25, 2011 at 11:30 PM, aditi garg wrote: > @Rajeev yes its clear now...thanx a lot:) > > > On Mon, Jul 25, 2011 at 11:27 PM, nitesh wrote: > >> Well the output will be compiler dependent. I am usin

Re: [algogeeks] OUTPUT

2011-07-25 Thread aditi garg
@Rajeev yes its clear now...thanx a lot:) On Mon, Jul 25, 2011 at 11:27 PM, nitesh wrote: > Well the output will be compiler dependent. I am using Dev C++ which > supports gcc based compilers and am getting deifferent answer > > #include > main() > { > int i=1; > printf("\n%d",i^=1%2); > printf(

Re: [algogeeks] OUTPUT

2011-07-25 Thread nitesh
Well the output will be compiler dependent. I am using Dev C++ which supports gcc based compilers and am getting deifferent answer #include main() { int i=1; printf("\n%d",i^=1%2); printf("\n%d %d",i^=1%2,i<<=1%2); return 0; } Output: 0 1 0 -- You received this message because you are subscrib

Re: [algogeeks] OUTPUT

2011-07-25 Thread rajeev bharshetty
#include main() { int i=1; printf("\n%d%d, i<<=1%2); return 0; } In the above program the output is 2 as expected . now since #include main() { int i=1; printf("\n%d%d ",i<<=2,i<<=1%2); return 0; } Now since we are introducing an another statement which modifies i in the same line , the previ

Re: [algogeeks] OUTPUT

2011-07-25 Thread aditi garg
Can u plz elaborate...im not able to understand... On Mon, Jul 25, 2011 at 11:04 PM, rajeev bharshetty wrote: > @sameer I think that is right > > > On Mon, Jul 25, 2011 at 11:02 PM, sameer.mut...@gmail.com < > sameer.mut...@gmail.com> wrote: > >> its because of side effect where value of i is get

Re: [algogeeks] OUTPUT

2011-07-25 Thread rajeev bharshetty
#include main() { int i=1; printf("\n%d ",i<<=1%2); return 0; } Try only this It provides o/p as 2 so it must be side effect. On Mon, Jul 25, 2011 at 11:04 PM, rajeev bharshetty wrote: > @sameer I think that is right > > > On Mon, Jul 25, 2011 at 11:02 PM, sameer.mut...@gmail.com < > sameer.mu

Re: [algogeeks] OUTPUT

2011-07-25 Thread rajeev bharshetty
@sameer I think that is right On Mon, Jul 25, 2011 at 11:02 PM, sameer.mut...@gmail.com < sameer.mut...@gmail.com> wrote: > its because of side effect where value of i is getting changed twice in a > single line. > correct me if i am wrong :) > > *Muthuraj R. > 4TH Year BE.** > Information Scienc

Re: [algogeeks] OUTPUT

2011-07-25 Thread sameer.mut...@gmail.com
its because of side effect where value of i is getting changed twice in a single line. correct me if i am wrong :) *Muthuraj R. 4TH Year BE.** Information Science Dept* *PESIT, Bengaluru . * On Mon, Jul 25, 2011 at 11:01 PM, geek forgeek wrote: > y not the output is 3 2 coz on right to left e

Re: [algogeeks] OUTPUT

2011-07-25 Thread geek forgeek
y not the output is 3 2 coz on right to left evaluation of printf i shud be left shifted by 1 bit wgich shud make it 2 ?? On Mon, Jul 25, 2011 at 10:28 AM, sameer.mut...@gmail.com < sameer.mut...@gmail.com> wrote: > yeah output > 0 > 1 1 > *is dis because of side effect? * > * * > * > * > *Mut

Re: [algogeeks] OUTPUT

2011-07-25 Thread sameer.mut...@gmail.com
yeah output 0 1 1 *is dis because of side effect? * * * * * *Muthuraj R. 4TH Year BE.** Information Science Dept* *PESIT, Bengaluru . * On Mon, Jul 25, 2011 at 10:49 PM, Deoki Nandan wrote: > run on gcc compiler it would be > 0 > 1 1 > > > On Mon, Jul 25, 2011 at 10:35 PM, geek forgeek wrote

Re: [algogeeks] OUTPUT

2011-07-25 Thread geek forgeek
ma mistake code is #include main() { int i=1; printf("\n%d %d",i^=1%2,i<<=1%2); return 0; } On Mon, Jul 25, 2011 at 10:19 AM, Deoki Nandan wrote: > run on gcc compiler it would be > 0 > 1 1 > > On Mon, Jul 25, 2011 at 10:35 PM, geek forgeek wrote: > >> 1. >> #include >> main() >> { >> int i=

Re: [algogeeks] OUTPUT

2011-07-25 Thread rajeev bharshetty
@Deoki Remove the first printf from the program .. You will get 3 3 . The first printf should be removed . And about the output as 3 3 it is beacuse of the right to left eval of printf so i has value 3 after evaluation. On Mon, Jul 25, 2011 at 10:49 PM, Deoki Nandan wrote: > run on gcc compiler

Re: [algogeeks] OUTPUT

2011-07-25 Thread aditi garg
@ Deoki : Can u please explain how did dis outcome come? On Mon, Jul 25, 2011 at 10:49 PM, Deoki Nandan wrote: > run on gcc compiler it would be > 0 > 1 1 > > > On Mon, Jul 25, 2011 at 10:35 PM, geek forgeek wrote: > >> 1. >> #include >> main() >> { >> int i=1; >> printf("\n%d",i^=1%2); >> pr

Re: [algogeeks] OUTPUT

2011-07-25 Thread Deoki Nandan
run on gcc compiler it would be 0 1 1 On Mon, Jul 25, 2011 at 10:35 PM, geek forgeek wrote: > 1. > #include > main() > { > int i=1; > printf("\n%d",i^=1%2); > printf("\n%d %d",i^=1%2,i<<=1%2); > return 0; > } > > output 3 3 > hey shudnt the output be 3 2 > > > -- > You received this message be

Re: [algogeeks] output please

2011-07-25 Thread kavitha nk
it is printed in %d format nd not as %ch... -- //BE COOL// kavi -- 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+unsu

Re: [algogeeks] output please

2011-07-25 Thread Arshad Alam
yes I understand, thanks to both of you On Sun, Jul 24, 2011 at 10:10 PM, rajeev bharshetty wrote: > value 200 exceeds the char range so -56 , to print 200 try unsigned char . > > On Sun, Jul 24, 2011 at 10:06 PM, Prashant Gupta > wrote: > >> -56 >> >> >> On Sun, Jul 24, 2011 at 8:15 PM, Arshad

Re: [algogeeks] output please

2011-07-24 Thread rajeev bharshetty
value 200 exceeds the char range so -56 , to print 200 try unsigned char . On Sun, Jul 24, 2011 at 10:06 PM, Prashant Gupta wrote: > -56 > > > On Sun, Jul 24, 2011 at 8:15 PM, Arshad Alam wrote: > >> #include >> #include >> void main() >> { >> char ch=200; >> printf("\n%d",ch); >> ge

  1   2   >