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 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