if you have any doubt than run it i have done so......it is running ....

On Thu, Jul 14, 2011 at 9:38 AM, saurabh singh <[email protected]> wrote:

> By the way I am no master of D but isn't it compilation error?
> D was made to imitate java concept of importing libraries....So its a
> compile error anyway,:)
>
> On Thu, Jul 14, 2011 at 9:30 AM, sanjay ahuja 
> <[email protected]>wrote:
>
>> because your type is int (signed) and not unsigned..make it unsigned
>> you will understand why is like this!
>>
>>
>> On Thu, Jul 14, 2011 at 9:27 AM, John Hayes <[email protected]>
>> wrote:
>> > @saurabh ....why in 2's complement form ?
>> >
>> > On Thu, Jul 14, 2011 at 9:21 AM, saurabh singh <[email protected]>
>> wrote:
>> >>
>> >> There is nothing wrong going wrong in the code shilpa.
>> >> It specifies bit field
>> >> a has now only 1 bit
>> >> b has 2 bit.
>> >> when u write t.a=6=(0110) it is stored as 0.
>> >> while when u write t.b=2 it is stored as 10 which in 2's complement its
>> >> -2.
>> >> check size of t if you doubt me.
>> >> On Thu, Jul 14, 2011 at 9:11 AM, shilpa gupta <
>> [email protected]>
>> >> wrote:
>> >>>
>> >>> in second problem a:1 and b:3 means default initialization but not in
>> c
>> >>> it is D programming language but u may b trying to compile it with c
>> >>> complier
>> >>> that's why it is showing wrong result..........if u will compile it
>> with
>> >>> D language compiler than it will print 6 and 2.....and if u will not
>> >>> initialize them again with 6 and 2 then it will print 1 and 2
>> >>>
>> >>>
>> >>> On Thu, Jul 14, 2011 at 8:27 AM, John Hayes <[email protected]
>> >
>> >>> wrote:
>> >>>>
>> >>>> Hey Guys, plz help me in getting these 2 C output problems
>> >>>>
>> >>>> 1st problem
>> >>>>
>> >>>> #include<stdio.h>
>> >>>> int main()
>> >>>> {
>> >>>> short int a,b,c;
>> >>>> scanf("%d%d",&a,&b);
>> >>>> c=a+b;
>> >>>> printf("%d",c);
>> >>>> return 0;
>> >>>> }
>> >>>> INPUT-
>> >>>> 1 1
>> >>>> OUTPUT
>> >>>> 1
>> >>>> i am not getting why  1 is coming in the output.....what difference
>> is
>> >>>> using short making in the code ???
>> >>>> Problem No. 2
>> >>>> #include<stdio.h>
>> >>>> main()
>> >>>> {
>> >>>> struct
>> >>>> {
>> >>>> int a:1;
>> >>>> int b:2;
>> >>>> }t;
>> >>>> t.b=6;
>> >>>> t.a=2;
>> >>>> printf("%d %d",t.a,t.b);
>> >>>> }
>> >>>> OUTPUT
>> >>>> 0 -2
>> >>>> What does the statement  a:1 and b:1 mean and what are they
>> doing.....i
>> >>>> am seeing them first time ever...hence not able to get the
>> output....if
>> >>>> someone has any idea plz help  !!
>> >>>>
>> >>>> --
>> >>>> You received this message because you are subscribed to the Google
>> >>>> Groups "Algorithm Geeks" group.
>> >>>> To post to this group, send email to [email protected].
>> >>>> To unsubscribe from this group, send email to
>> >>>> [email protected].
>> >>>> For more options, visit this group at
>> >>>> http://groups.google.com/group/algogeeks?hl=en.
>> >>>
>> >>>
>> >>>
>> >>> --
>> >>> shilpa gupta
>> >>> b tech 2nd year
>> >>> computer science and engineering
>> >>> mnnit allahabad
>> >>>
>> >>> --
>> >>> You received this message because you are subscribed to the Google
>> Groups
>> >>> "Algorithm Geeks" group.
>> >>> To post to this group, send email to [email protected].
>> >>> To unsubscribe from this group, send email to
>> >>> [email protected].
>> >>> For more options, visit this group at
>> >>> http://groups.google.com/group/algogeeks?hl=en.
>> >>
>> >>
>> >>
>> >> --
>> >> Saurabh Singh
>> >> B.Tech (Computer Science)
>> >> MNNIT ALLAHABAD
>> >>
>> >>
>> >> --
>> >> You received this message because you are subscribed to the Google
>> Groups
>> >> "Algorithm Geeks" group.
>> >> To post to this group, send email to [email protected].
>> >> To unsubscribe from this group, send email to
>> >> [email protected].
>> >> For more options, visit this group at
>> >> http://groups.google.com/group/algogeeks?hl=en.
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> Groups
>> > "Algorithm Geeks" group.
>> > To post to this group, send email to [email protected].
>> > To unsubscribe from this group, send email to
>> > [email protected].
>> > For more options, visit this group at
>> > http://groups.google.com/group/algogeeks?hl=en.
>> >
>>
>>
>>
>> --
>> Sanjay Ahuja,
>> Analyst, Financing Prime Brokerage
>> Nomura Securities India Pvt. Ltd
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>>
>
>
> --
> Saurabh Singh
> B.Tech (Computer Science)
> MNNIT ALLAHABAD
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
shilpa gupta
b tech 2nd year
computer science and engineering
mnnit allahabad

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to