Re: [algogeeks] C QUESTION???

2012-01-10 Thread Rahul Verma
thanks for the info

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/E1c87OjP6LAJ.
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C QUESTION???

2012-01-06 Thread payal gupta
@utkarsh n tejbala ...thnx..4 d info.

Regards,
Payal gupta,
3rd year,cse,
NIT-Bhopal


On Sat, Jan 7, 2012 at 9:30 AM, teja bala  wrote:

> ## concatenating operator
>
>
> On Sat, Jan 7, 2012 at 9:01 AM, UTKARSH SRIVASTAV  > wrote:
>
>> yes payal read a standard c book like dennis ritchie ... these are
>> the best source
>>
>>
>> On Sat, Jan 7, 2012 at 1:53 AM, payal gupta  wrote:
>>
>>> @parag thnx...
>>> btw is dere ny source dat has ny info bout it??
>>>
>>> Regards,
>>> Payal Gupta,
>>> 3rd year,
>>> NIT-Bhopal
>>>
>>>
>>> On Sat, Jan 7, 2012 at 12:36 AM, parag khanna 
>>> wrote:
>>>


 On Sat, Jan 7, 2012 at 12:36 AM, parag khanna >>> > wrote:

>
> it joins the variables together ... for eg 1##2 = 12 or a##b=ab
>


>
>
>
>
>
> --
> *Parag Khanna
> B.tech Final Year
> NIT,Kurukshetra*
>



 --
 *Parag Khanna
 B.tech Final Year
 NIT,Kurukshetra*

 --
 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, 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 algogeeks@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>
>>
>> --
>> *UTKARSH SRIVASTAV
>> CSE-3
>> B-Tech 3rd Year
>> @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 algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> 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 algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> 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 algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C QUESTION???

2012-01-06 Thread teja bala
## concatenating operator

On Sat, Jan 7, 2012 at 9:01 AM, UTKARSH SRIVASTAV
wrote:

> yes payal read a standard c book like dennis ritchie ... these are the
> best source
>
>
> On Sat, Jan 7, 2012 at 1:53 AM, payal gupta  wrote:
>
>> @parag thnx...
>> btw is dere ny source dat has ny info bout it??
>>
>> Regards,
>> Payal Gupta,
>> 3rd year,
>> NIT-Bhopal
>>
>>
>> On Sat, Jan 7, 2012 at 12:36 AM, parag khanna 
>> wrote:
>>
>>>
>>>
>>> On Sat, Jan 7, 2012 at 12:36 AM, parag khanna 
>>> wrote:
>>>

 it joins the variables together ... for eg 1##2 = 12 or a##b=ab

>>>
>>>





 --
 *Parag Khanna
 B.tech Final Year
 NIT,Kurukshetra*

>>>
>>>
>>>
>>> --
>>> *Parag Khanna
>>> B.tech Final Year
>>> NIT,Kurukshetra*
>>>
>>> --
>>> 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, 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 algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> *UTKARSH SRIVASTAV
> CSE-3
> B-Tech 3rd Year
> @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 algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> 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 algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C QUESTION???

2012-01-06 Thread UTKARSH SRIVASTAV
yes payal read a standard c book like dennis ritchie ... these are the
best source

On Sat, Jan 7, 2012 at 1:53 AM, payal gupta  wrote:

> @parag thnx...
> btw is dere ny source dat has ny info bout it??
>
> Regards,
> Payal Gupta,
> 3rd year,
> NIT-Bhopal
>
>
> On Sat, Jan 7, 2012 at 12:36 AM, parag khanna wrote:
>
>>
>>
>> On Sat, Jan 7, 2012 at 12:36 AM, parag khanna 
>> wrote:
>>
>>>
>>> it joins the variables together ... for eg 1##2 = 12 or a##b=ab
>>>
>>
>>
>>>
>>>
>>>
>>>
>>>
>>> --
>>> *Parag Khanna
>>> B.tech Final Year
>>> NIT,Kurukshetra*
>>>
>>
>>
>>
>> --
>> *Parag Khanna
>> B.tech Final Year
>> NIT,Kurukshetra*
>>
>> --
>> 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, 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 algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
*UTKARSH SRIVASTAV
CSE-3
B-Tech 3rd Year
@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 algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C QUESTION???

2012-01-06 Thread payal gupta
@parag thnx...
btw is dere ny source dat has ny info bout it??

Regards,
Payal Gupta,
3rd year,
NIT-Bhopal

On Sat, Jan 7, 2012 at 12:36 AM, parag khanna wrote:

>
>
> On Sat, Jan 7, 2012 at 12:36 AM, parag khanna wrote:
>
>>
>> it joins the variables together ... for eg 1##2 = 12 or a##b=ab
>>
>
>
>>
>>
>>
>>
>>
>> --
>> *Parag Khanna
>> B.tech Final Year
>> NIT,Kurukshetra*
>>
>
>
>
> --
> *Parag Khanna
> B.tech Final Year
> NIT,Kurukshetra*
>
> --
> 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, 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 algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C QUESTION???

2012-01-06 Thread parag khanna
On Sat, Jan 7, 2012 at 12:36 AM, parag khanna wrote:

>
> it joins the variables together ... for eg 1##2 = 12 or a##b=ab
>


>
>
>
>
>
> --
> *Parag Khanna
> B.tech Final Year
> NIT,Kurukshetra*
>



-- 
*Parag Khanna
B.tech Final Year
NIT,Kurukshetra*

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C QUESTION???

2012-01-06 Thread parag khanna
it joins the variables together ... for eg 1##2 = 12





-- 
*Parag Khanna
B.tech Final Year
NIT,Kurukshetra*

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] C QUESTION???

2012-01-06 Thread payal gupta
Wat is the use of ## in define??



#include 
#define f(g,g2) g##g2
void main()
{
int var12 =100;
printf("%d",f(var,12));

}

o/p :100


-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/o1OhOAqADHgJ.
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] c question

2011-09-03 Thread sukran dhawan
when u pass array as an argument to a function only the starting address is
passed .so sizeof(a) is address of pointer !

On Sat, Sep 3, 2011 at 6:22 PM, priya ramesh  wrote:

> In any C program,
> int main(){
> char a[100];
> foo(a);
> printf("%d", sizeof(a));
> }
> foo(char *s){
> printf("%d", sizeof(a));
> }
>
> In main sizeof a is 100, in foo it is 4. why??
>
> --
> 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, 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 algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] c question

2011-09-03 Thread Anup Ghatage
Isn't it obvious now?

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] c question

2011-09-03 Thread priya ramesh
ok i got this point.
Plz answer this,

s is a pointer in foo and a is also a constant pointer in main. (a is passed
to foo)
However, in main a is treated as an rvalue and in s the same pointer is an
lvalue. why??

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] c question

2011-09-03 Thread Anup Ghatage
See, a is defined in main() therefore its scope is limited to main(). It is
stored probably in main()'s stack
When you pass it to a function as a pointer. You don't make a copy of 'a'
onto the function's stack.
The only way you can view, manipulate it is using a pointer, and that
pointer is your only reference to the value that is stored somewhere else.
That's why.

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] c question

2011-09-03 Thread rajul jain
As declaration of a[100] is defined in main function so main function print
100 , but foo() only know a pointer to a char data type that is why it print
4 in function foo()

correct me if i am wrong!

On Sat, Sep 3, 2011 at 6:52 PM, UTKARSH SRIVASTAV
wrote:

> char  *p,char [] are both same they  both have size 4
>
>
> On Sat, Sep 3, 2011 at 6:18 AM, himanshu kansal <
> himanshukansal...@gmail.com> wrote:
>
>> array is always given a special treatment...its nt a constant
>> ptrits an array means 100 bytes r resrvd for it
>> for this i think u mst go thru pointers in c and ritchi books.
>>
>>
>> On Sat, Sep 3, 2011 at 6:41 PM, priya ramesh <
>> love.for.programm...@gmail.com> wrote:
>>
>>> foo(char []s){
>>> printf("%d", sizeof(s));
>>> }
>>>
>>> even now it prints 4.
>>> My point is s pointer in foo and a is also a constant pointer in main. (a
>>> is passed to foo)
>>> However, in main a is treated as an rvalue and in s the same pointer is
>>> an lvalue. why??
>>>
>>> Someone plz reply. It's urgent
>>>
>>> --
>>> 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, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>
>>
>> --
>>
>>Regards
>>  Himanshu Kansal
>>Msc Comp. sc.
>> (University of Delhi)
>>
>>
>>  --
>> 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, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> *UTKARSH SRIVASTAV
> CSE-3
> B-Tech 3rd Year
> @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 algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> 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 algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] c question

2011-09-03 Thread UTKARSH SRIVASTAV
char  *p,char [] are both same they  both have size 4

On Sat, Sep 3, 2011 at 6:18 AM, himanshu kansal  wrote:

> array is always given a special treatment...its nt a constant
> ptrits an array means 100 bytes r resrvd for it
> for this i think u mst go thru pointers in c and ritchi books.
>
>
> On Sat, Sep 3, 2011 at 6:41 PM, priya ramesh <
> love.for.programm...@gmail.com> wrote:
>
>> foo(char []s){
>> printf("%d", sizeof(s));
>> }
>>
>> even now it prints 4.
>> My point is s pointer in foo and a is also a constant pointer in main. (a
>> is passed to foo)
>> However, in main a is treated as an rvalue and in s the same pointer is an
>> lvalue. why??
>>
>> Someone plz reply. It's urgent
>>
>> --
>> 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, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
>
>Regards
>  Himanshu Kansal
>Msc Comp. sc.
> (University of Delhi)
>
>
>  --
> 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, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
*UTKARSH SRIVASTAV
CSE-3
B-Tech 3rd Year
@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 algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] c question

2011-09-03 Thread himanshu kansal
array is always given a special treatment...its nt a constant ptrits
an array means 100 bytes r resrvd for it
for this i think u mst go thru pointers in c and ritchi books.

On Sat, Sep 3, 2011 at 6:41 PM, priya ramesh  wrote:

> foo(char []s){
> printf("%d", sizeof(s));
> }
>
> even now it prints 4.
> My point is s pointer in foo and a is also a constant pointer in main. (a
> is passed to foo)
> However, in main a is treated as an rvalue and in s the same pointer is an
> lvalue. why??
>
> Someone plz reply. It's urgent
>
> --
> 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, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 

   Regards
 Himanshu Kansal
   Msc Comp. sc.
(University of Delhi)

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] c question

2011-09-03 Thread priya ramesh
foo(char []s){
printf("%d", sizeof(s));
}

even now it prints 4.
My point is s pointer in foo and a is also a constant pointer in main. (a is
passed to foo)
However, in main a is treated as an rvalue and in s the same pointer is an
lvalue. why??

Someone plz reply. It's urgent

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] c question

2011-09-03 Thread rajul jain
foo(char *s){
printf("%d", sizeof(s));   // correction
}

in this function foo s is a pointer so it print size of pointer which is 4 .

On Sat, Sep 3, 2011 at 6:22 PM, priya ramesh  wrote:

> In any C program,
> int main(){
> char a[100];
> foo(a);
> printf("%d", sizeof(a));
> }
> foo(char *s){
> printf("%d", sizeof(a));
> }
>
> In main sizeof a is 100, in foo it is 4. why??
>
> --
> 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, 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 algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] c question

2011-09-03 Thread priya ramesh
In any C program,
int main(){
char a[100];
foo(a);
printf("%d", sizeof(a));
}
foo(char *s){
printf("%d", sizeof(a));
}

In main sizeof a is 100, in foo it is 4. why??

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C-question

2011-08-22 Thread Vijay Khandar
Thank,,,Now got it.

On Tue, Aug 23, 2011 at 11:22 AM, nagarajan  wrote:

> Hi Vijay,
>
> i = 10 < 10 < 5
>
> => 0 < 5
>
> => 1
>
> On Tue, Aug 23, 2011 at 11:03 AM, Vijay Khandar 
> wrote:
>
>> main()
>> {
>> int x=10,y=10,z=5;
>> int i=x> pf("\n%d",i);
>>
>> }
>> o/p is 1 .pls any1 explain me hw is it printing?
>>
>> --
>> 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, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>>
>
>
> --
>
>
> Nagarajan S
>
>  --
> 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, 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 algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C-question

2011-08-22 Thread nagarajan
Hi Vijay,

i = 10 < 10 < 5

=> 0 < 5

=> 1

On Tue, Aug 23, 2011 at 11:03 AM, Vijay Khandar wrote:

> main()
> {
> int x=10,y=10,z=5;
> int i=x pf("\n%d",i);
>
> }
> o/p is 1 .pls any1 explain me hw is it printing?
>
> --
> 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, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 


Nagarajan S

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] C-question

2011-08-22 Thread Vijay Khandar
main()
{
int x=10,y=10,z=5;
int i=xhttp://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] c question

2011-08-21 Thread Abhishek
it can also be understood as, range of signed integers are 
-2^(no. of bits-1) to 2^(no. of bits-1)-1

so here is only one bit so its range will be from -1 to 0.
that's why storing 1 means -1.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/Xwqu8zxk3RkJ.
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] c question

2011-08-21 Thread Nitin
thnx:)

On Sun, Aug 21, 2011 at 9:26 AM, Sanjay Rajpal  wrote:

> See you are considering one bit of bit1, and printing it as signed integer.
> So what i think is that '1' bit will be treated as   while treating
> it as Signed Integer, and this is the binary representation of
> -1. Hence the result.
>
> If you write it as unsigned int bit1:1, the result is 122. So my argument
> is correct.
>
> Try this and let me know.
>
> Correct me If m wrong.
> Sanju
> :)
>
>
>
> On Sat, Aug 20, 2011 at 8:44 PM, sukran dhawan wrote:
>
>> only one bit is reserved for it.so the binary representation is 1.since
>> only one bit is present,
>> that bit becomes sign nit and hence -1
>>
>> On Sun, Aug 21, 2011 at 8:07 AM, saurabh singh wrote:
>>
>>> Read bit field
>>>
>>>
>>> On Sun, Aug 21, 2011 at 2:44 AM, Nitin  wrote:
>>>
 #include
 main()
 {
   struct value
 {
   int bit1:1;
 int bit2:4;
 int bit3:4;
 }bit={1,2,2};
 printf("%d%d%d",bit.bit1,bit.bit2,bit.bit3);
 }

 output is -1,2,2;
 can anybody tell me the reason that y it is giving -1 ??


 --
 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, 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 algogeeks@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com.
>>> 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 algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> 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 algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> 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 algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C-Question

2011-08-21 Thread Vijay Khandar
Thanks puneet ...

On Sun, Aug 21, 2011 at 6:01 PM, Puneet Chawla wrote:

> forgot to mention last byte 00 then 2nd last 00 and so on AC then 40
>
>
> On Sun, Aug 21, 2011 at 6:00 PM, Puneet Chawla 
> wrote:
>
>> Compiler is little endian so as u have typecasted it to char pointer then
>> 0100  1010 1100     means 4 0 A C 0 0 0 0 it will show
>> o/p byte by byte from LSB.
>>
>>
>> On Sun, Aug 21, 2011 at 5:47 PM, Vijay Khandar 
>> wrote:
>>
>>> Thank u very much Abhishek for this link, Now I got it ...But
>>> also u explain me in following..
>>> 5.375 is represents 0100  1010 1100     means 4 0 A C
>>> 0 0 0 0in Hex now how it prints 00 00 AC 40 means can it accepts fm right to
>>> left or L to R I m little bit confusing in p[0] p[1] p[2]and p[3]
>>> how these r printing 0 0 AC 40plz Explain
>>>   On Sun, Aug 21, 2011 at 4:57 PM, Abhishek <
>>> mailatabhishekgu...@gmail.com> wrote:
>>>
 check this link..
 http://en.wikipedia.org/wiki/Single_precision_floating-point_format

 --
 You received this message because you are subscribed to the Google
 Groups "Algorithm Geeks" group.
 To view this discussion on the web visit
 https://groups.google.com/d/msg/algogeeks/-/OTIkO_pXQMgJ.

 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, 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 algogeeks@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>
>>
>> --
>> With regards
>>   
>> Puneet
>>
>
>
>
> --
> With regards
>   
> Puneet Chawla
> Computer Engineering Student
> NIT Kurukshetra
>
> --
> 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, 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 algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C-Question

2011-08-21 Thread Vijay Khandar
I was thinking the same ..byte by byte from R to L thank u very
muchNow i have got it..On Sun, Aug 21, 2011 at 6:01 PM,
Puneet Chawla  wrote:

> forgot to mention last byte 00 then 2nd last 00 and so on AC then 40
>
>
> On Sun, Aug 21, 2011 at 6:00 PM, Puneet Chawla 
> wrote:
>
>> Compiler is little endian so as u have typecasted it to char pointer then
>> 0100  1010 1100     means 4 0 A C 0 0 0 0 it will show
>> o/p byte by byte from LSB.
>>
>>
>> On Sun, Aug 21, 2011 at 5:47 PM, Vijay Khandar 
>> wrote:
>>
>>> Thank u very much Abhishek for this link, Now I got it ...But
>>> also u explain me in following..
>>> 5.375 is represents 0100  1010 1100     means 4 0 A C
>>> 0 0 0 0in Hex now how it prints 00 00 AC 40 means can it accepts fm right to
>>> left or L to R I m little bit confusing in p[0] p[1] p[2]and p[3]
>>> how these r printing 0 0 AC 40plz Explain
>>>   On Sun, Aug 21, 2011 at 4:57 PM, Abhishek <
>>> mailatabhishekgu...@gmail.com> wrote:
>>>
 check this link..
 http://en.wikipedia.org/wiki/Single_precision_floating-point_format

 --
 You received this message because you are subscribed to the Google
 Groups "Algorithm Geeks" group.
 To view this discussion on the web visit
 https://groups.google.com/d/msg/algogeeks/-/OTIkO_pXQMgJ.

 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, 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 algogeeks@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>
>>
>> --
>> With regards
>>   
>> Puneet
>>
>
>
>
> --
> With regards
>   
> Puneet Chawla
> Computer Engineering Student
> NIT Kurukshetra
>
> --
> 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, 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 algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C-Question

2011-08-21 Thread Puneet Chawla
forgot to mention last byte 00 then 2nd last 00 and so on AC then 40

On Sun, Aug 21, 2011 at 6:00 PM, Puneet Chawla wrote:

> Compiler is little endian so as u have typecasted it to char pointer then
> 0100  1010 1100     means 4 0 A C 0 0 0 0 it will show
> o/p byte by byte from LSB.
>
>
> On Sun, Aug 21, 2011 at 5:47 PM, Vijay Khandar wrote:
>
>> Thank u very much Abhishek for this link, Now I got it ...But also
>> u explain me in following..
>> 5.375 is represents 0100  1010 1100     means 4 0 A C
>> 0 0 0 0in Hex now how it prints 00 00 AC 40 means can it accepts fm right to
>> left or L to R I m little bit confusing in p[0] p[1] p[2]and p[3]
>> how these r printing 0 0 AC 40plz Explain
>>  On Sun, Aug 21, 2011 at 4:57 PM, Abhishek > > wrote:
>>
>>> check this link..
>>> http://en.wikipedia.org/wiki/Single_precision_floating-point_format
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msg/algogeeks/-/OTIkO_pXQMgJ.
>>>
>>> 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, 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 algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> With regards
>   
> Puneet
>



-- 
With regards
  
Puneet Chawla
Computer Engineering Student
NIT Kurukshetra

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C-Question

2011-08-21 Thread Puneet Chawla
Compiler is little endian so as u have typecasted it to char pointer then
0100  1010 1100     means 4 0 A C 0 0 0 0 it will show
o/p byte by byte from LSB.

On Sun, Aug 21, 2011 at 5:47 PM, Vijay Khandar wrote:

> Thank u very much Abhishek for this link, Now I got it ...But also
> u explain me in following..
> 5.375 is represents 0100  1010 1100     means 4 0 A C 0
> 0 0 0in Hex now how it prints 00 00 AC 40 means can it accepts fm right to
> left or L to R I m little bit confusing in p[0] p[1] p[2]and p[3]
> how these r printing 0 0 AC 40plz Explain
>  On Sun, Aug 21, 2011 at 4:57 PM, Abhishek 
> wrote:
>
>> check this link..
>> http://en.wikipedia.org/wiki/Single_precision_floating-point_format
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msg/algogeeks/-/OTIkO_pXQMgJ.
>>
>> 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, 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 algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
With regards
  
Puneet

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C-Question

2011-08-21 Thread Vijay Khandar
Thank u very much Abhishek for this link, Now I got it ...But also u
explain me in following..
5.375 is represents 0100  1010 1100     means 4 0 A C 0
0 0 0in Hex now how it prints 00 00 AC 40 means can it accepts fm right to
left or L to R I m little bit confusing in p[0] p[1] p[2]and p[3]
how these r printing 0 0 AC 40plz Explain
On Sun, Aug 21, 2011 at 4:57 PM, Abhishek wrote:

> check this link..
> http://en.wikipedia.org/wiki/Single_precision_floating-point_format
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/algogeeks/-/OTIkO_pXQMgJ.
>
> 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, 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 algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C-Question

2011-08-21 Thread Abhishek
check this link..
http://en.wikipedia.org/wiki/Single_precision_floating-point_format

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/OTIkO_pXQMgJ.
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] c question what is output?

2011-08-21 Thread Sanjay Rajpal
Nopes, its a funda of PRE-PROCESSOR directives.

Look before the object code is generated for the program, all the occurences
of the MACROs are replaced with their expansions as such as in the
definition.

So what u r doing is completely wrong.

For more info on MACROs, refer any text book of C.
Sanju
:)



On Sun, Aug 21, 2011 at 4:05 AM, Ayswarya Srinivasan
wrote:

> doesn it work like below ?
>
>
>
> func2(8)= 8 * func1(7)
>
> func1(7)= 7*6
>
> so i=8*7*6???
>
>
>
> On Sun, Aug 21, 2011 at 3:58 PM, Sanjay Rajpal  wrote:
>
>> +1 to sagar
>> Sanju
>> :)
>>
>>
>>
>> On Sun, Aug 21, 2011 at 3:26 AM, sagar pareek wrote:
>>
>>> FUNC2(i) =  i==0?i*(i-1*(i-1-1))
>>>
>>> 8==0?1:8*(8-1*(8-1-1))
>>> 8==0?1:8*(8-6)
>>> 8==0?1:8*2
>>> 8==0?1:16
>>>
>>> hence it will return 16
>>>
>>>
>>> On Sun, Aug 21, 2011 at 11:40 AM, SuDhir mIsHra <
>>> sudhir08.mis...@gmail.com> wrote:
>>>
  #include
 #define FUNC1(i) (i*(i-1))
 #define FUNC2(i) (i==0?1:i*FUNC1(i-1))
 main()
 {
 int i=8;


 printf("\n%d",FUNC2(i));
 }

 --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.

>>>
>>>
>>>
>>> --
>>> **Regards
>>> SAGAR PAREEK
>>> COMPUTER SCIENCE AND ENGINEERING
>>> NIT ALLAHABAD
>>>
>>> --
>>> 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, 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 algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
>  Regards,
> Ayswarya S
>
>   --
> 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, 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 algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] c question what is output?

2011-08-21 Thread Ayswarya Srinivasan
doesn it work like below ?



func2(8)= 8 * func1(7)

func1(7)= 7*6

so i=8*7*6???



On Sun, Aug 21, 2011 at 3:58 PM, Sanjay Rajpal  wrote:

> +1 to sagar
> Sanju
> :)
>
>
>
> On Sun, Aug 21, 2011 at 3:26 AM, sagar pareek wrote:
>
>> FUNC2(i) =  i==0?i*(i-1*(i-1-1))
>>
>> 8==0?1:8*(8-1*(8-1-1))
>> 8==0?1:8*(8-6)
>> 8==0?1:8*2
>> 8==0?1:16
>>
>> hence it will return 16
>>
>>
>> On Sun, Aug 21, 2011 at 11:40 AM, SuDhir mIsHra <
>> sudhir08.mis...@gmail.com> wrote:
>>
>>>  #include
>>> #define FUNC1(i) (i*(i-1))
>>> #define FUNC2(i) (i==0?1:i*FUNC1(i-1))
>>> main()
>>> {
>>> int i=8;
>>>
>>>
>>> printf("\n%d",FUNC2(i));
>>> }
>>>
>>> --
>>> 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, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>
>>
>> --
>> **Regards
>> SAGAR PAREEK
>> COMPUTER SCIENCE AND ENGINEERING
>> NIT ALLAHABAD
>>
>> --
>> 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, 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 algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Regards,
Ayswarya S

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] c question what is output?

2011-08-21 Thread Sanjay Rajpal
+1 to sagar
Sanju
:)



On Sun, Aug 21, 2011 at 3:26 AM, sagar pareek  wrote:

> FUNC2(i) =  i==0?i*(i-1*(i-1-1))
>
> 8==0?1:8*(8-1*(8-1-1))
> 8==0?1:8*(8-6)
> 8==0?1:8*2
> 8==0?1:16
>
> hence it will return 16
>
>
> On Sun, Aug 21, 2011 at 11:40 AM, SuDhir mIsHra  > wrote:
>
>>  #include
>> #define FUNC1(i) (i*(i-1))
>> #define FUNC2(i) (i==0?1:i*FUNC1(i-1))
>> main()
>> {
>> int i=8;
>>
>>
>> printf("\n%d",FUNC2(i));
>> }
>>
>> --
>> 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, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> **Regards
> SAGAR PAREEK
> COMPUTER SCIENCE AND ENGINEERING
> NIT ALLAHABAD
>
> --
> 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, 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 algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] c question what is output?

2011-08-21 Thread sagar pareek
FUNC2(i) =  i==0?i*(i-1*(i-1-1))

8==0?1:8*(8-1*(8-1-1))
8==0?1:8*(8-6)
8==0?1:8*2
8==0?1:16

hence it will return 16

On Sun, Aug 21, 2011 at 11:40 AM, SuDhir mIsHra
wrote:

> #include
> #define FUNC1(i) (i*(i-1))
> #define FUNC2(i) (i==0?1:i*FUNC1(i-1))
> main()
> {
> int i=8;
>
>
> printf("\n%d",FUNC2(i));
> }
>
> --
> 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, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
**Regards
SAGAR PAREEK
COMPUTER SCIENCE AND ENGINEERING
NIT ALLAHABAD

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] c question what is output?

2011-08-21 Thread SuDhir mIsHra
#include
#define FUNC1(i) (i*(i-1))
#define FUNC2(i) (i==0?1:i*FUNC1(i-1))
main()
{
int i=8;


printf("\n%d",FUNC2(i));
}

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C-Question

2011-08-21 Thread Vijay Khandar
Can you explain me shortly how 5.375 is converted into normalised
form...How to find mantissa and Exponent in this case? Plz Explain
meVijay
On Sun, Aug 21, 2011 at 1:25 PM, Rahul Tiwari wrote:

>
>
> On Sun, Aug 21, 2011 at 11:11 AM, Rahul Tiwari 
> wrote:
>
>> @vijay 
>> u take normalised form of 5.375 wrong .
>> actual normalised form of 5.375 = 0100  1010 1100    
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> On Sun, Aug 21, 2011 at 10:12 AM, Vijay Khandar 
>> wrote:
>>
>>> but why only o/p-00 00 AC 40 and not AC 40 00 00 or 00 AC 40 00 or 40 AC
>>> 00 00etc , plz explain in detail how p[0] pts to 00 and p[1] pts to 00 and
>>> p[2] pts AC or 1010 1100 and p[3] pts to 40 or 0100  ONLY in this
>>> way..Vijay Khandar...
>>>
>>>
>>> On Sat, Aug 20, 2011 at 12:31 PM, Dipankar Patro wrote:
>>>
 float is 4 bytes.
 so a=3.75 will be stored in 4 bytes in memory.

 the moment you have a pointer referring to the same memory location but
 type cast to (char *), the pointer will refer to character i.e. 1 byte.
 ^^ this explains the p[0] , p[1], p[2], p[3] <- 4 bytes of the 3.75

 now finally the o/p
 00 00 AC 40
 ^^ it is in little endian format. i.e the data bytes are stored in
 memory is reverse format.

 On 20 August 2011 11:21, Vijay Khandar  wrote:

> If the binary equivalent of 5.375 in normalised form is - 0100 
> 1010  1100   
>
> what is the o/p of following code-
> main()
> {
> float a=5.375;
> char *p;
> int i;
> p=(char *)&a;
> for(i=0;i<=3;i++)
> printf("%02X",(unsigned char)p[i]);
> }
>
> O/P= 00 00 AC 40
> Plz, Plz  anyone explain me in detail, how this o/p is coming?
> Vijay..
>
> --
> 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, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


 --

 ___

 Please do not print this e-mail until urgent requirement. Go Green!!
 Save Papers <=> Save Trees

 --
 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, 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 algogeeks@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>
>>
>> --
>> Rahul Tiwari aka  " DONE "
>> B Tech Final Year
>> Information Technology
>> Motilal Nehru National Institute of Technology , Allahabad
>> 9838339030
>>
>>
>
>
> --
> Rahul Tiwari aka  " DONE "
> B Tech Final Year
> Information Technology
> Motilal Nehru National Institute of Technology , Allahabad
> 9838339030
>
> --
> 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, 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 algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C-Question

2011-08-21 Thread Rahul Tiwari
On Sun, Aug 21, 2011 at 11:11 AM, Rahul Tiwari wrote:

> @vijay 
> u take normalised form of 5.375 wrong .
> actual normalised form of 5.375 = 0100  1010 1100    
>
>
>
>
>
>
>
>
>
> On Sun, Aug 21, 2011 at 10:12 AM, Vijay Khandar 
> wrote:
>
>> but why only o/p-00 00 AC 40 and not AC 40 00 00 or 00 AC 40 00 or 40 AC
>> 00 00etc , plz explain in detail how p[0] pts to 00 and p[1] pts to 00 and
>> p[2] pts AC or 1010 1100 and p[3] pts to 40 or 0100  ONLY in this
>> way..Vijay Khandar...
>>
>>
>> On Sat, Aug 20, 2011 at 12:31 PM, Dipankar Patro wrote:
>>
>>> float is 4 bytes.
>>> so a=3.75 will be stored in 4 bytes in memory.
>>>
>>> the moment you have a pointer referring to the same memory location but
>>> type cast to (char *), the pointer will refer to character i.e. 1 byte.
>>> ^^ this explains the p[0] , p[1], p[2], p[3] <- 4 bytes of the 3.75
>>>
>>> now finally the o/p
>>> 00 00 AC 40
>>> ^^ it is in little endian format. i.e the data bytes are stored in memory
>>> is reverse format.
>>>
>>> On 20 August 2011 11:21, Vijay Khandar  wrote:
>>>
 If the binary equivalent of 5.375 in normalised form is - 0100 
 1010  1100   

 what is the o/p of following code-
 main()
 {
 float a=5.375;
 char *p;
 int i;
 p=(char *)&a;
 for(i=0;i<=3;i++)
 printf("%02X",(unsigned char)p[i]);
 }

 O/P= 00 00 AC 40
 Plz, Plz  anyone explain me in detail, how this o/p is coming?
 Vijay..

 --
 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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


>>>
>>>
>>> --
>>>
>>> ___
>>>
>>> Please do not print this e-mail until urgent requirement. Go Green!!
>>> Save Papers <=> Save Trees
>>>
>>> --
>>> 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, 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 algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> Rahul Tiwari aka  " DONE "
> B Tech Final Year
> Information Technology
> Motilal Nehru National Institute of Technology , Allahabad
> 9838339030
>
>


-- 
Rahul Tiwari aka  " DONE "
B Tech Final Year
Information Technology
Motilal Nehru National Institute of Technology , Allahabad
9838339030

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C-Question

2011-08-20 Thread Rahul Tiwari
@vijay 
u take normalised form of 5.375 wrong .
actual normalised form of 5.375 = 0100 1000 1010 1100    








On Sun, Aug 21, 2011 at 10:12 AM, Vijay Khandar wrote:

> but why only o/p-00 00 AC 40 and not AC 40 00 00 or 00 AC 40 00 or 40 AC 00
> 00etc , plz explain in detail how p[0] pts to 00 and p[1] pts to 00 and p[2]
> pts AC or 1010 1100 and p[3] pts to 40 or 0100  ONLY in this
> way..Vijay Khandar...
>
>
> On Sat, Aug 20, 2011 at 12:31 PM, Dipankar Patro wrote:
>
>> float is 4 bytes.
>> so a=3.75 will be stored in 4 bytes in memory.
>>
>> the moment you have a pointer referring to the same memory location but
>> type cast to (char *), the pointer will refer to character i.e. 1 byte.
>> ^^ this explains the p[0] , p[1], p[2], p[3] <- 4 bytes of the 3.75
>>
>> now finally the o/p
>> 00 00 AC 40
>> ^^ it is in little endian format. i.e the data bytes are stored in memory
>> is reverse format.
>>
>> On 20 August 2011 11:21, Vijay Khandar  wrote:
>>
>>> If the binary equivalent of 5.375 in normalised form is - 0100 
>>> 1010  1100   
>>>
>>> what is the o/p of following code-
>>> main()
>>> {
>>> float a=5.375;
>>> char *p;
>>> int i;
>>> p=(char *)&a;
>>> for(i=0;i<=3;i++)
>>> printf("%02X",(unsigned char)p[i]);
>>> }
>>>
>>> O/P= 00 00 AC 40
>>> Plz, Plz  anyone explain me in detail, how this o/p is coming?
>>> Vijay..
>>>
>>> --
>>> 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, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>>
>>
>>
>> --
>>
>> ___
>>
>> Please do not print this e-mail until urgent requirement. Go Green!!
>> Save Papers <=> Save Trees
>>
>> --
>> 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, 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 algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Rahul Tiwari aka  " DONE "
B Tech Final Year
Information Technology
Motilal Nehru National Institute of Technology , Allahabad
9838339030

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C-Question

2011-08-20 Thread Vijay Khandar
but why only o/p-00 00 AC 40 and not AC 40 00 00 or 00 AC 40 00 or 40 AC 00
00etc , plz explain in detail how p[0] pts to 00 and p[1] pts to 00 and p[2]
pts AC or 1010 1100 and p[3] pts to 40 or 0100  ONLY in this
way..Vijay Khandar...

On Sat, Aug 20, 2011 at 12:31 PM, Dipankar Patro wrote:

> float is 4 bytes.
> so a=3.75 will be stored in 4 bytes in memory.
>
> the moment you have a pointer referring to the same memory location but
> type cast to (char *), the pointer will refer to character i.e. 1 byte.
> ^^ this explains the p[0] , p[1], p[2], p[3] <- 4 bytes of the 3.75
>
> now finally the o/p
> 00 00 AC 40
> ^^ it is in little endian format. i.e the data bytes are stored in memory
> is reverse format.
>
> On 20 August 2011 11:21, Vijay Khandar  wrote:
>
>> If the binary equivalent of 5.375 in normalised form is - 0100 
>> 1010  1100   
>>
>> what is the o/p of following code-
>> main()
>> {
>> float a=5.375;
>> char *p;
>> int i;
>> p=(char *)&a;
>> for(i=0;i<=3;i++)
>> printf("%02X",(unsigned char)p[i]);
>> }
>>
>> O/P= 00 00 AC 40
>> Plz, Plz  anyone explain me in detail, how this o/p is coming?
>> Vijay..
>>
>> --
>> 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, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>>
>
>
> --
>
> ___
>
> Please do not print this e-mail until urgent requirement. Go Green!!
> Save Papers <=> Save Trees
>
> --
> 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, 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 algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] c question

2011-08-20 Thread Sanjay Rajpal
See you are considering one bit of bit1, and printing it as signed integer.
So what i think is that '1' bit will be treated as   while treating
it as Signed Integer, and this is the binary representation of
-1. Hence the result.

If you write it as unsigned int bit1:1, the result is 122. So my argument is
correct.

Try this and let me know.

Correct me If m wrong.
Sanju
:)



On Sat, Aug 20, 2011 at 8:44 PM, sukran dhawan wrote:

> only one bit is reserved for it.so the binary representation is 1.since
> only one bit is present,
> that bit becomes sign nit and hence -1
>
> On Sun, Aug 21, 2011 at 8:07 AM, saurabh singh wrote:
>
>> Read bit field
>>
>>
>> On Sun, Aug 21, 2011 at 2:44 AM, Nitin  wrote:
>>
>>> #include
>>> main()
>>> {
>>>   struct value
>>> {
>>>   int bit1:1;
>>> int bit2:4;
>>> int bit3:4;
>>> }bit={1,2,2};
>>> printf("%d%d%d",bit.bit1,bit.bit2,bit.bit3);
>>> }
>>>
>>> output is -1,2,2;
>>> can anybody tell me the reason that y it is giving -1 ??
>>>
>>>
>>> --
>>> 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, 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 algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> 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 algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> 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 algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] c question

2011-08-20 Thread sukran dhawan
only one bit is reserved for it.so the binary representation is 1.since only
one bit is present,
that bit becomes sign nit and hence -1
On Sun, Aug 21, 2011 at 8:07 AM, saurabh singh  wrote:

> Read bit field
>
>
> On Sun, Aug 21, 2011 at 2:44 AM, Nitin  wrote:
>
>> #include
>> main()
>> {
>>   struct value
>> {
>>   int bit1:1;
>> int bit2:4;
>> int bit3:4;
>> }bit={1,2,2};
>> printf("%d%d%d",bit.bit1,bit.bit2,bit.bit3);
>> }
>>
>> output is -1,2,2;
>> can anybody tell me the reason that y it is giving -1 ??
>>
>>
>>  --
>> 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, 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 algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> 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 algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] c question

2011-08-20 Thread saurabh singh
Read bit field

On Sun, Aug 21, 2011 at 2:44 AM, Nitin  wrote:

> #include
> main()
> {
>   struct value
> {
>   int bit1:1;
> int bit2:4;
> int bit3:4;
> }bit={1,2,2};
> printf("%d%d%d",bit.bit1,bit.bit2,bit.bit3);
> }
>
> output is -1,2,2;
> can anybody tell me the reason that y it is giving -1 ??
>
>
>  --
> 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, 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 algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] c question

2011-08-20 Thread Nitin
#include
main()
{
  struct value
{
  int bit1:1;
int bit2:4;
int bit3:4;
}bit={1,2,2};
printf("%d%d%d",bit.bit1,bit.bit2,bit.bit3);
}

output is -1,2,2;
can anybody tell me the reason that y it is giving -1 ??

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C question

2011-08-20 Thread SANDEEP CHUGH
okey thnks @sukran.. :)

On Sat, Aug 20, 2011 at 4:20 PM, sukran dhawan wrote:

> @sandeep
>
> number which is a power of 2 only one bit will be set.
> number -1 : all the bits except the one which was set at num with be 1
> so num & num-1 will be 0 coz of bitwise and
>
> On Sat, Aug 20, 2011 at 4:18 PM, SANDEEP CHUGH wrote:
>
>> @sukran  explain plz
>>
>> On Sat, Aug 20, 2011 at 4:16 PM, sukran dhawan wrote:
>>
>>> one more condition is required
>>>
>>> if(num != 0 && !( num & (num-1))
>>>
>>> On Sat, Aug 20, 2011 at 4:04 PM, Sanjay Rajpal  wrote:
>>>
 if(!(x & x-1)) printf("No. is power of 2");


 Sanju
 :)



 On Sat, Aug 20, 2011 at 3:32 AM, Abhishek Yadav <
 algowithabhis...@gmail.com> wrote:

> Give a one-line C expression to test whether a number is a power of 2.
>
> --
> 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, 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 algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 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 algogeeks@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com.
>>> 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 algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> 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 algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> 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 algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C question

2011-08-20 Thread sukran dhawan
@sandeep

number which is a power of 2 only one bit will be set.
number -1 : all the bits except the one which was set at num with be 1
so num & num-1 will be 0 coz of bitwise and

On Sat, Aug 20, 2011 at 4:18 PM, SANDEEP CHUGH wrote:

> @sukran  explain plz
>
> On Sat, Aug 20, 2011 at 4:16 PM, sukran dhawan wrote:
>
>> one more condition is required
>>
>> if(num != 0 && !( num & (num-1))
>>
>> On Sat, Aug 20, 2011 at 4:04 PM, Sanjay Rajpal  wrote:
>>
>>> if(!(x & x-1)) printf("No. is power of 2");
>>>
>>>
>>> Sanju
>>> :)
>>>
>>>
>>>
>>> On Sat, Aug 20, 2011 at 3:32 AM, Abhishek Yadav <
>>> algowithabhis...@gmail.com> wrote:
>>>
 Give a one-line C expression to test whether a number is a power of 2.

 --
 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, 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 algogeeks@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com.
>>> 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 algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> 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 algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> 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 algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C question

2011-08-20 Thread Sanjay Rajpal
O yes, thanx sukran :)
I forgot that.


Sanju
:)



On Sat, Aug 20, 2011 at 3:46 AM, sukran dhawan wrote:

> one more condition is required
>
> if(num != 0 && !( num & (num-1))
>
>  On Sat, Aug 20, 2011 at 4:04 PM, Sanjay Rajpal  wrote:
>
>>   if(!(x & x-1)) printf("No. is power of 2");
>>
>>
>> Sanju
>> :)
>>
>>
>>
>> On Sat, Aug 20, 2011 at 3:32 AM, Abhishek Yadav <
>> algowithabhis...@gmail.com> wrote:
>>
>>> Give a one-line C expression to test whether a number is a power of 2.
>>>
>>> --
>>> 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, 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 algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> 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 algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> 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 algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C question

2011-08-20 Thread SANDEEP CHUGH
@sukran  explain plz

On Sat, Aug 20, 2011 at 4:16 PM, sukran dhawan wrote:

> one more condition is required
>
> if(num != 0 && !( num & (num-1))
>
> On Sat, Aug 20, 2011 at 4:04 PM, Sanjay Rajpal  wrote:
>
>> if(!(x & x-1)) printf("No. is power of 2");
>>
>>
>> Sanju
>> :)
>>
>>
>>
>> On Sat, Aug 20, 2011 at 3:32 AM, Abhishek Yadav <
>> algowithabhis...@gmail.com> wrote:
>>
>>> Give a one-line C expression to test whether a number is a power of 2.
>>>
>>> --
>>> 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, 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 algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> 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 algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> 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 algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C question

2011-08-20 Thread sukran dhawan
@sandeep

number which is a power of 2 only one bit will be set.
number -1 : all the bits except the one which was set at num with be 1
so num & num-1 will be 0 coz of bitwise and


On Sat, Aug 20, 2011 at 4:15 PM, SANDEEP CHUGH wrote:

> explain it plz
>
>
> On Sat, Aug 20, 2011 at 4:09 PM, Abhishek Yadav <
> algowithabhis...@gmail.com> wrote:
>
>> got it ...thanks
>>
>>
>> On Sat, Aug 20, 2011 at 4:04 PM, Sanjay Rajpal  wrote:
>>
>>> if(!(x & x-1)) printf("No. is power of 2");
>>>
>>>
>>> Sanju
>>> :)
>>>
>>>
>>>
>>> On Sat, Aug 20, 2011 at 3:32 AM, Abhishek Yadav <
>>> algowithabhis...@gmail.com> wrote:
>>>
 Give a one-line C expression to test whether a number is a power of 2.

 --
 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, 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 algogeeks@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com.
>>> 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 algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> 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 algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> 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 algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C question

2011-08-20 Thread Sanjay Rajpal
See if a number is power of 2, then only one bit in the number will be set.
e.g. for 16, 0001 assuming 8-bit representation.
then when you subtract 1 from this number, the bits to the right of the
previously set bit will be set, and the set bit will become unset.
e.g. 16 will become 15, .

Take bitwise and, th result will be 0 if it is a power of 2.
taking Logical NOT will give 1.

Hence the result.
Sanju
:)



On Sat, Aug 20, 2011 at 3:45 AM, SANDEEP CHUGH wrote:

> explain it plz
>
>
> On Sat, Aug 20, 2011 at 4:09 PM, Abhishek Yadav <
> algowithabhis...@gmail.com> wrote:
>
>> got it ...thanks
>>
>>
>> On Sat, Aug 20, 2011 at 4:04 PM, Sanjay Rajpal  wrote:
>>
>>>  if(!(x & x-1)) printf("No. is power of 2");
>>>
>>>
>>> Sanju
>>> :)
>>>
>>>
>>>
>>> On Sat, Aug 20, 2011 at 3:32 AM, Abhishek Yadav <
>>> algowithabhis...@gmail.com> wrote:
>>>
 Give a one-line C expression to test whether a number is a power of 2.

 --
 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, 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 algogeeks@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com.
>>> 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 algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> 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 algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> 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 algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C question

2011-08-20 Thread sukran dhawan
one more condition is required

if(num != 0 && !( num & (num-1))

On Sat, Aug 20, 2011 at 4:04 PM, Sanjay Rajpal  wrote:

> if(!(x & x-1)) printf("No. is power of 2");
>
>
> Sanju
> :)
>
>
>
> On Sat, Aug 20, 2011 at 3:32 AM, Abhishek Yadav <
> algowithabhis...@gmail.com> wrote:
>
>> Give a one-line C expression to test whether a number is a power of 2.
>>
>> --
>> 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, 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 algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> 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 algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C question

2011-08-20 Thread SANDEEP CHUGH
explain it plz

On Sat, Aug 20, 2011 at 4:09 PM, Abhishek Yadav
wrote:

> got it ...thanks
>
>
> On Sat, Aug 20, 2011 at 4:04 PM, Sanjay Rajpal  wrote:
>
>> if(!(x & x-1)) printf("No. is power of 2");
>>
>>
>> Sanju
>> :)
>>
>>
>>
>> On Sat, Aug 20, 2011 at 3:32 AM, Abhishek Yadav <
>> algowithabhis...@gmail.com> wrote:
>>
>>> Give a one-line C expression to test whether a number is a power of 2.
>>>
>>> --
>>> 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, 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 algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> 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 algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> 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 algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C question

2011-08-20 Thread Abhishek Yadav
got it ...thanks

On Sat, Aug 20, 2011 at 4:04 PM, Sanjay Rajpal  wrote:

> if(!(x & x-1)) printf("No. is power of 2");
>
>
> Sanju
> :)
>
>
>
> On Sat, Aug 20, 2011 at 3:32 AM, Abhishek Yadav <
> algowithabhis...@gmail.com> wrote:
>
>> Give a one-line C expression to test whether a number is a power of 2.
>>
>> --
>> 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, 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 algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> 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 algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C question

2011-08-20 Thread Sanjay Rajpal
if(!(x & x-1)) printf("No. is power of 2");


Sanju
:)



On Sat, Aug 20, 2011 at 3:32 AM, Abhishek Yadav
wrote:

> Give a one-line C expression to test whether a number is a power of 2.
>
> --
> 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, 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 algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] C question

2011-08-20 Thread Abhishek Yadav
Give a one-line C expression to test whether a number is a power of 2.

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C-Question

2011-08-20 Thread rajul jain
 5.375 in normalised form is - 0100  1010  1100   
As we type cast into char
so in little endian system it take 8 bits from last and store into p[0] ,
then it take next 8 bits store it into p[1] so on ...
In printf statement here X is specifier for float so it print hexadecimal
equivalent of binary number.


On Sat, Aug 20, 2011 at 11:21 AM, Vijay Khandar wrote:

> If the binary equivalent of 5.375 in normalised form is - 0100 
> 1010  1100   
>
> what is the o/p of following code-
> main()
> {
> float a=5.375;
> char *p;
> int i;
> p=(char *)&a;
> for(i=0;i<=3;i++)
> printf("%02X",(unsigned char)p[i]);
> }
>
> O/P= 00 00 AC 40
> Plz, Plz  anyone explain me in detail, how this o/p is coming?
> Vijay..
>
> --
> 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, 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 algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C-Question

2011-08-20 Thread Sanjay Rajpal
+1 to Dipankar


Sanju
:)



On Sat, Aug 20, 2011 at 12:01 AM, Dipankar Patro wrote:

> float is 4 bytes.
> so a=3.75 will be stored in 4 bytes in memory.
>
> the moment you have a pointer referring to the same memory location but
> type cast to (char *), the pointer will refer to character i.e. 1 byte.
> ^^ this explains the p[0] , p[1], p[2], p[3] <- 4 bytes of the 3.75
>
> now finally the o/p
> 00 00 AC 40
> ^^ it is in little endian format. i.e the data bytes are stored in memory
> is reverse format.
>
> On 20 August 2011 11:21, Vijay Khandar  wrote:
>
>> If the binary equivalent of 5.375 in normalised form is - 0100 
>> 1010  1100   
>>
>> what is the o/p of following code-
>> main()
>> {
>> float a=5.375;
>> char *p;
>> int i;
>> p=(char *)&a;
>> for(i=0;i<=3;i++)
>> printf("%02X",(unsigned char)p[i]);
>> }
>>
>> O/P= 00 00 AC 40
>> Plz, Plz  anyone explain me in detail, how this o/p is coming?
>> Vijay..
>>
>> --
>> 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, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>>
>
>
> --
>
> ___
>
> Please do not print this e-mail until urgent requirement. Go Green!!
> Save Papers <=> Save Trees
>
> --
> 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, 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 algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C-Question

2011-08-20 Thread Dipankar Patro
float is 4 bytes.
so a=3.75 will be stored in 4 bytes in memory.

the moment you have a pointer referring to the same memory location but type
cast to (char *), the pointer will refer to character i.e. 1 byte.
^^ this explains the p[0] , p[1], p[2], p[3] <- 4 bytes of the 3.75

now finally the o/p
00 00 AC 40
^^ it is in little endian format. i.e the data bytes are stored in memory is
reverse format.

On 20 August 2011 11:21, Vijay Khandar  wrote:

> If the binary equivalent of 5.375 in normalised form is - 0100 
> 1010  1100   
>
> what is the o/p of following code-
> main()
> {
> float a=5.375;
> char *p;
> int i;
> p=(char *)&a;
> for(i=0;i<=3;i++)
> printf("%02X",(unsigned char)p[i]);
> }
>
> O/P= 00 00 AC 40
> Plz, Plz  anyone explain me in detail, how this o/p is coming?
> Vijay..
>
> --
> 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, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
___

Please do not print this e-mail until urgent requirement. Go Green!!
Save Papers <=> Save Trees

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] C-Question

2011-08-19 Thread Vijay Khandar
If the binary equivalent of 5.375 in normalised form is - 0100 
1010  1100   

what is the o/p of following code-
main()
{
float a=5.375;
char *p;
int i;
p=(char *)&a;
for(i=0;i<=3;i++)
printf("%02X",(unsigned char)p[i]);
}

O/P= 00 00 AC 40
Plz, Plz  anyone explain me in detail, how this o/p is coming?
Vijay..

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] c question

2011-08-14 Thread muthu raj
The problem is because of \n in the prnintf statement. When new line is
there in first printf it flushes the standard buffer and so in child the
output of printf is not present in second program.
*Muthuraj R
IV th Year , ISE
PESIT , Bangalore*



On Sat, Aug 13, 2011 at 9:29 PM, Ankur Khurana wrote:

>
> aren't two programs same ? and scheduling of two forked and parent process
> is prcoessor dependent. You dont have a say in it.
>
> On Sun, Aug 14, 2011 at 1:21 AM, thanu moorthy wrote:
>
>> #include
>> #include
>> int main()
>> {
>>   int return_value;
>>   printf("forking process");
>>   fork();
>> printf("hello\n");
>> return 0;
>>
>>  }
>>
>> in the above program the output is
>>
>> forking processhello
>> forking processhello
>>
>> but in the below prog
>>
>>
>>   include
>> #include
>> int main()
>> {
>>   int return_value;
>>   printf("forking process\n");
>>   fork();
>> printf("hello\n");
>> return 0;
>>
>>  }
>> the output is
>> forking process
>> hello
>> hello
>>
>> why its so ??
>>
>> --
>> by $THANU$
>>
>>  --
>> 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, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> Ankur Khurana
> Computer Science
> Netaji Subhas Institute Of Technology
> Delhi.
>
>  --
> 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, 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 algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] c question

2011-08-13 Thread Ankur Khurana
aren't two programs same ? and scheduling of two forked and parent process
is prcoessor dependent. You dont have a say in it.
On Sun, Aug 14, 2011 at 1:21 AM, thanu moorthy wrote:

> #include
> #include
> int main()
> {
>   int return_value;
>   printf("forking process");
>   fork();
> printf("hello\n");
> return 0;
>
>  }
>
> in the above program the output is
>
> forking processhello
> forking processhello
>
> but in the below prog
>
>
>   include
> #include
> int main()
> {
>   int return_value;
>   printf("forking process\n");
>   fork();
> printf("hello\n");
> return 0;
>
>  }
> the output is
> forking process
> hello
> hello
>
> why its so ??
>
> --
> by $THANU$
>
>  --
> 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, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Ankur Khurana
Computer Science
Netaji Subhas Institute Of Technology
Delhi.

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] c question

2011-08-13 Thread thanu moorthy
#include
#include
int main()
{
  int return_value;
  printf("forking process");
  fork();
printf("hello\n");
return 0;

 }

in the above program the output is

forking processhello
forking processhello

but in the below prog


  include
#include
int main()
{
  int return_value;
  printf("forking process\n");
  fork();
printf("hello\n");
return 0;

 }
the output is
forking process
hello
hello

why its so ??

-- 
by $THANU$

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] c question!

2011-08-11 Thread Arun Vishwanathan
hmm ya am sorry abt that..what abt the first part i mentioned...how is it
(nodeptr*)malloc according to you (which is creating a pointer to a pointer
type nodeptr )rather than just nodeptr which is a pointer to structure?
how to get size of structure as such in this case?

On Thu, Aug 11, 2011 at 7:04 AM, siddharth srivastava
wrote:

>
>
>  (sizeof(struct)); ??
>>
>
> That doesn't makes sense. Size of struct is what ?? you need the size of
> your structure with the variables you have declared in it.
>
>
>>
>> cos malloc returns pointer to memory block and nodeptr itself is a pointer
>> and you have used nodeptr* further?
>>
>>
>>
>> On Tue, Aug 9, 2011 at 6:32 PM, siddharth srivastava > > wrote:
>>
>>>  @sidharth: thanks a lot for correcting me :)
 @aditya : no. there was some mistake;

 in the code i pasted above it's giving segmentation fault. Is it cause
 i'm initializing h without using malloc??
 Please throw light on this problem

>>>
>>> Pointer points to a location in memory. You can't use h without making h
>>> to reference to some area in memory.
>>>
>>>
>>>
 And in the following code
 char *s;
 scanf("%s", s);
 why isn't it possible to store a string in s??

 Please explain both concepts.

 --
  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, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.

>>>
>>>
>>>
>>> --
>>> Regards
>>> Siddharth Srivastava
>>>
>>>
>>>
>>> --
>>> 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, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>
>>
>> --
>>  "People often say that motivation doesn't last. Well, neither does
>> bathing - that's why we recommend it daily."
>>
>> --
>> 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, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> Regards
> Siddharth Srivastava
>
>
> --
> 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, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
 "People often say that motivation doesn't last. Well, neither does bathing
- that's why we recommend it daily."

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] c question!

2011-08-10 Thread siddharth srivastava
(sizeof(struct)); ??
>

That doesn't makes sense. Size of struct is what ?? you need the size of
your structure with the variables you have declared in it.


>
> cos malloc returns pointer to memory block and nodeptr itself is a pointer
> and you have used nodeptr* further?
>
>
>
> On Tue, Aug 9, 2011 at 6:32 PM, siddharth srivastava 
> wrote:
>
>>  @sidharth: thanks a lot for correcting me :)
>>> @aditya : no. there was some mistake;
>>>
>>> in the code i pasted above it's giving segmentation fault. Is it cause
>>> i'm initializing h without using malloc??
>>> Please throw light on this problem
>>>
>>
>> Pointer points to a location in memory. You can't use h without making h
>> to reference to some area in memory.
>>
>>
>>
>>> And in the following code
>>> char *s;
>>> scanf("%s", s);
>>> why isn't it possible to store a string in s??
>>>
>>> Please explain both concepts.
>>>
>>> --
>>>  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, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>
>>
>> --
>> Regards
>> Siddharth Srivastava
>>
>>
>>
>> --
>> 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, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
>  "People often say that motivation doesn't last. Well, neither does
> bathing - that's why we recommend it daily."
>
>  --
> 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, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Regards
Siddharth Srivastava

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C question

2011-08-10 Thread Karthikeyan palani
@ram got it. tanx :)

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] c question!

2011-08-10 Thread Arun Vishwanathan
@siddarth:

should not the statement you mentioned above as
nodeptr h = (nodeptr*)malloc(sizeof(nodeptr*));

be
nodeptr h =(struct*)malloc(sizeof(struct)); ??

cos malloc returns pointer to memory block and nodeptr itself is a pointer
and you have used nodeptr* further?



On Tue, Aug 9, 2011 at 6:32 PM, siddharth srivastava wrote:

>  @sidharth: thanks a lot for correcting me :)
>> @aditya : no. there was some mistake;
>>
>> in the code i pasted above it's giving segmentation fault. Is it cause i'm
>> initializing h without using malloc??
>> Please throw light on this problem
>>
>
> Pointer points to a location in memory. You can't use h without making h to
> reference to some area in memory.
>
>
>
>> And in the following code
>> char *s;
>> scanf("%s", s);
>> why isn't it possible to store a string in s??
>>
>> Please explain both concepts.
>>
>> --
>>  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, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> Regards
> Siddharth Srivastava
>
>
>
> --
> 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, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
 "People often say that motivation doesn't last. Well, neither does bathing
- that's why we recommend it daily."

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C question

2011-08-09 Thread Raman
signed char 129 = -127

127 =>   0111 
-127 =>   1000 0001  (2's compliment form) = ff81 (hex)

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/0Y7Ev0aJuLgJ.
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C question

2011-08-09 Thread programming love
Correct me if i'm wrong. I think it's cos at a time it'll fetch the amount
of bytes = to it's register's size.
If a 32-bit machine is being used, answer will contain 4 bytes
 ff81

16-bit machine -  ff81

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] C question

2011-08-09 Thread Karthikeyan palani
main()
{
char a=129;

printf("%0x",a);
}

the o/p whch i'm getting s ff81.. why is tat so?
as char s 1 byte why 2 bytes r printed...



-- 
karthikeyankkn

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] c question!

2011-08-09 Thread siddharth srivastava
>
> @sidharth: thanks a lot for correcting me :)
> @aditya : no. there was some mistake;
>
> in the code i pasted above it's giving segmentation fault. Is it cause i'm
> initializing h without using malloc??
> Please throw light on this problem
>

Pointer points to a location in memory. You can't use h without making h to
reference to some area in memory.



> And in the following code
> char *s;
> scanf("%s", s);
> why isn't it possible to store a string in s??
>
> Please explain both concepts.
>
> --
> 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, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Regards
Siddharth Srivastava

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] c question!

2011-08-09 Thread rohit jangid
when you declared " h" it contains garbage address . h->a is meaningless .
read pointers chapter from K nd R for full details about pointers in C .
 On Aug 9, 2011 9:11 PM, "programming love" 
wrote:
> #includetypedef struct {char * a;
> }*nodeptr;
> main(){nodeptr h;h->a="programming";printf("hi %s\n", h->a);}
>
> @sidharth: thanks a lot for correcting me :)
> @aditya : no. there was some mistake;
>
> in the code i pasted above it's giving segmentation fault. Is it cause i'm
> initializing h without using malloc??
> Please throw light on this problem
> And in the following code
> char *s;
> scanf("%s", s);
> why isn't it possible to store a string in s??
>
> Please explain both concepts.
>
> --
> 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, 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 algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] c question!

2011-08-09 Thread programming love
#includetypedef struct {char * a;
}*nodeptr;
main(){nodeptr h;h->a="programming";printf("hi %s\n", h->a);}

@sidharth: thanks a lot for correcting me :)
@aditya : no. there was some mistake;

in the code i pasted above it's giving segmentation fault. Is it cause i'm
initializing h without using malloc??
Please throw light on this problem
And in the following code
char *s;
scanf("%s", s);
why isn't it possible to store a string in s??

Please explain both concepts.

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] c question!

2011-08-09 Thread rohit jangid
a new pointer type that can store the address of such structure

for example

nodeptr p;

will declare a pointer to that struct
but it is useless for me.
On Aug 9, 2011 8:19 PM, "programming love" 
wrote:
> @rohith, what if that statement is removed. Now, what will nodeptr stand
> for?
>
> On Tue, Aug 9, 2011 at 8:09 PM, rohit jangid 
wrote:
>
>> it will give error in line 3 because nodeptr is undefined till that
point..
>>
>> On Aug 9, 2011 8:03 PM, "programming love" <
love.for.programm...@gmail.com>
>> wrote:
>> --
>> 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, 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 algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
algogeeks+unsubscr...@googlegroups.com.
> 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 algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] c question!

2011-08-09 Thread siddharth srivastava
>
>
>>>
>>> this gives an error. Please explain the concept behind this.
>>>
>>
try using something like this:

#include
#include
typedef struct {
char * a;

}* nodeptr;

main(){
nodeptr h = (nodeptr*)malloc(sizeof(nodeptr*));
h->a="programming";
printf("hi %s\n", h->a);
}


though
typedef struct{
char *a;
} nodeptr;

would be better in terms of readability and understanding.



>
>>>
>>
>> You have used typedef incorrectly
>>
>>>
>>>  --
>>> 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, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>
>>
>> --
>> Regards
>> Siddharth Srivastava
>>
>>
>>
>>  --
>> 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, 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 algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Regards
Siddharth Srivastava

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] c question!

2011-08-09 Thread Rohit Srivastava
dont use *h just use h

On Tue, Aug 9, 2011 at 8:31 PM, siddharth srivastava wrote:

> Hi
>
> On 9 August 2011 20:26, programming love 
> wrote:
>
>>   #includetypedef struct {char * a;
>> }*nodeptr;
>> main(){nodeptr *h;h->a="programming";printf("hi %s\n", h->a);}
>>
>>
>> this gives an error. Please explain the concept behind this.
>>
>>
>
> You have used typedef incorrectly
>
>>
>>  --
>> 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, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> Regards
> Siddharth Srivastava
>
>
>
>  --
> 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, 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 algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] c question!

2011-08-09 Thread siddharth srivastava
Hi

On 9 August 2011 20:26, programming love wrote:

>   #includetypedef struct {char * a;
> }*nodeptr;
> main(){nodeptr *h;h->a="programming";printf("hi %s\n", h->a);}
>
>
> this gives an error. Please explain the concept behind this.
>
>

You have used typedef incorrectly

>
>  --
> 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, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Regards
Siddharth Srivastava

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] c question!

2011-08-09 Thread Aditya Virmani
is it giving an error at *nodeptr declaration?

On Tue, Aug 9, 2011 at 8:26 PM, programming love <
love.for.programm...@gmail.com> wrote:

>   #includetypedef struct {char * a;
> }*nodeptr;
> main(){nodeptr *h;h->a="programming";printf("hi %s\n", h->a);}
>
>
> this gives an error. Please explain the concept behind this.
>
>
>  --
> 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, 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 algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] c question!

2011-08-09 Thread programming love
#includetypedef struct {char * a;
}*nodeptr;
main(){nodeptr *h;h->a="programming";printf("hi %s\n", h->a);}


this gives an error. Please explain the concept behind this.

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] c question!

2011-08-09 Thread Rohit Srivastava
yep it will !!
any ways nodeptr is another name for pointer to the same structure so you
dont need to write struct *nodeptr
you can simply write nodeptr *p(say) to declare pointer to the structure

On Tue, Aug 9, 2011 at 8:09 PM, rohit jangid  wrote:

> it will give error in line 3 because nodeptr is undefined till that point..
>
> On Aug 9, 2011 8:03 PM, "programming love" 
> wrote:
>
> --
> 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, 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 algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] c question!

2011-08-09 Thread programming love
@rohith, what if that statement is removed. Now, what will nodeptr stand
for?

On Tue, Aug 9, 2011 at 8:09 PM, rohit jangid  wrote:

> it will give error in line 3 because nodeptr is undefined till that point..
>
> On Aug 9, 2011 8:03 PM, "programming love" 
> wrote:
>  --
> 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, 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 algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] c question!

2011-08-09 Thread rohit jangid
it will give error in line 3 because nodeptr is undefined till that point..

On Aug 9, 2011 8:03 PM, "programming love" 
wrote:

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] c question!

2011-08-09 Thread programming love
 *typedef struct {**
*
*char * a;**
*
*nodeptr next;**
*
*}*nodeptr;**
*
*
*
*what does nodeptr stand for??*

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C question.. sizeof operator

2011-08-03 Thread Vivek Ramamoorthy
output ll be 10..sizeof operation just find the size of the variable's
datatype..no changes for the variable inside the operation..

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C question.. increment decrement operator..

2011-08-03 Thread Puneet Gautam
As we know:
 In an expression, if pre n post occur
simultaneously, pre inc the value then n there only n post executes it
after that expression...and expression evaluates right to left...

 Also, the value of a variable in  an expression can be modified
multifold times...there is no restriction on dat...

Here in this code:
Print statement No.:

1.  i++*i++ is equivalent to:
 output i*i(7*7)
   followed by
i=i+1;
i=i+1;
prior to 2nd printf statement..that makes i=9

2. i++*++i
expn. evaluates right to left: i inc. by one due to pre..
i is now 10 .
output i*i(10*10)
i=i+1 (due to post inc., it inc. the value after the output)
 i is now 11

3. ++i*i++
 right to left evaluation, but post inc. increases value only after output..
coming to ++i in the expn., i inc. to 12
output: 12*12
i=i+1(due to postinc.)
 i is now 13

4. ++i*++i
both pre inc operators, order of evaluation doesnt ,matter:
i=i+1
i=i+1
output: 15*15

i finishes at 15

Hence the output:
49
100
144
225

I think i made it clear..
Feel free to point any loopholes..

Thanks.



On 8/3/11, ankit sambyal  wrote:
> Its compiler dependent. Acc. to the C standard an object's stored value can
> be modified only once in an expression.
>
> --
> 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, 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 algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C question.. increment decrement operator..

2011-08-03 Thread ankit sambyal
Its compiler dependent. Acc. to the C standard an object's stored value can
be modified only once in an expression.

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] C question.. increment decrement operator..

2011-08-03 Thread brijesh
Please give the output and explain..
main()
{
int i=7;
printf("%d\n",i++*i++);
printf("%d\n",i++*++i);
printf("%d\n",++i*i++);
printf("%d\n",++i*++i);
}

What is the order of execution!?

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C question.. sizeof operator

2011-08-03 Thread Xiaoxiao Qin
 sizeof is not a function. The inside content in sizeof() cannot be compiled 
during the compiling time, It will be replaced with the type. For example, 
compiler will replace the code as j = 4;  

So ++i does not execute.

 
On Aug 3, 2011, at 6:12 PM, brijesh wrote:

> main()
> {
> int i,j;
> i=10;
> j=sizeof(++i);
> printf("%d",i);
> }
> 
> please give the output with explanation!
> 
> -- 
> 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, visit this group at 
> http://groups.google.com/group/algogeeks?hl=en.
> 

(Steven Qin)
founder in Rfanti.com(烦题网)
Mobile: 18621588738
Office: +86-21-60832295
Rfanti / www.rfanti.com
单位: 上海阿拉丁电子商务有限责任公司
地址: 上海市宝山区淞桥东路111号联合滨江大厦1811
有问题,找烦题



-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C question.. sizeof operator

2011-08-03 Thread Rajeshwar Patra
i=10


-- 
*Rajeshwar Patra,*
*MCA final year,*
*Nit Durgapur*

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C question.. sizeof operator

2011-08-03 Thread sachin sharma
output would be 10
size of just calculate the type of the expression not the value


Best Wishes
Sachin Sharma

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] C question.. sizeof operator

2011-08-03 Thread brijesh
main()
{
int i,j;
i=10;
j=sizeof(++i);
printf("%d",i);
}

please give the output with explanation!

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C-Question

2011-08-02 Thread Vijay Khandar
Thanks Jagrati

On Tue, Aug 2, 2011 at 3:19 PM, jagrati verma
wrote:

> coz we do in  for loop 1st  initialization thn condition thn increment so
> in 1st for loop it will print the value thn increment the i's value so itll
> behave like a i++
> dats y no diffrence in the o/p
>
>
> :):)
>
> --
> 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, 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 algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C-Question

2011-08-02 Thread Vijay Khandar
Thanks Naveen..

On Tue, Aug 2, 2011 at 3:13 PM, naveen shukla <
naveenshuklasweetdrea...@gmail.com> wrote:

> Actually incrementing and decrementing whether pre and post will not
> affect in this case  because (increment and decrement ) will be done
> before checking the condition.
>
> As in for loop three sequential steps are .
>
> 1. Initialization
> 2. Checking condition
> 3. Increment or decrement
>
>
> On Tue, Aug 2, 2011 at 2:56 PM, Vijay Khandar 
> wrote:
> > for(i=1,j=10;i<6;++i,--j)
> > pf("%d %d",i,j);
> >
> > and
> >
> > for(i=1,j=10;i<6;i++,j--)
> > pf("%d %d",i,j);
> >
> > why this both giving same o/p, since one is pre and other is
> > postplz explain me
> >
> >
> > --
> > 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, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
> >
> >
>
>
>
> --
> From:
>
> Naveen Shukla
> IIIT Allahabad
> B.Tech IT 2nd year
> Mob No: 07860896972
> E-mail rit2009...@iiita.ac.in
>  naveenshuklasweetdrea...@gmail.com
>
> --
> 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, 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 algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C-Question

2011-08-02 Thread jagrati verma
coz we do in  for loop 1st  initialization thn condition thn increment so in
1st for loop it will print the value thn increment the i's value so itll
behave like a i++
dats y no diffrence in the o/p


:):)

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C-Question

2011-08-02 Thread naveen shukla
Actually incrementing and decrementing whether pre and post will not
affect in this case  because (increment and decrement ) will be done
before checking the condition.

As in for loop three sequential steps are .

1. Initialization
2. Checking condition
3. Increment or decrement


On Tue, Aug 2, 2011 at 2:56 PM, Vijay Khandar  wrote:
> for(i=1,j=10;i<6;++i,--j)
> pf("%d %d",i,j);
>
> and
>
> for(i=1,j=10;i<6;i++,j--)
> pf("%d %d",i,j);
>
> why this both giving same o/p, since one is pre and other is
> postplz explain me
>
>
> --
> 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, visit this group at 
> http://groups.google.com/group/algogeeks?hl=en.
>
>



-- 
From:

Naveen Shukla
IIIT Allahabad
B.Tech IT 2nd year
Mob No: 07860896972
E-mail rit2009...@iiita.ac.in
         naveenshuklasweetdrea...@gmail.com

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] C-Question

2011-08-02 Thread Vijay Khandar
for(i=1,j=10;i<6;++i,--j)
pf("%d %d",i,j);

and

for(i=1,j=10;i<6;i++,j--)
pf("%d %d",i,j);

why this both giving same o/p, since one is pre and other is
postplz explain me


-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C-Question

2011-08-01 Thread Vijay Khandar
Now got it Thank u very much Rajeev

On Mon, Aug 1, 2011 at 3:34 PM, rajeev bharshetty wrote:

> Becaus eof Bitwise and
>
>      0110 (6)
> &     0001 0010 (10)
>     0010  (2)
>
> So
> 0&0 0
> 0&1 0
> 1&0 0
> 1&1 1
>
>
> On Mon, Aug 1, 2011 at 3:31 PM, Vijay Khandar wrote:
>
>> main()
>> {
>> int a=6,b=10,x;
>> x=a&b;
>> printf("%d",x);
>> }
>>
>> O/P=2
>> Plz any one explain me ,how its come
>>
>> --
>> 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, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>>
>
>
> --
> Regards
> Rajeev N B 
>
> "*Winners Don't do Different things , they do things Differently"*
>
>  --
> 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, 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 algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] C-Question

2011-08-01 Thread Vijay Khandar
main()
{
int a=6,b=10,x;
x=a&b;
printf("%d",x);
}

O/P=2
Plz any one explain me ,how its come

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C-Question

2011-08-01 Thread rajeev bharshetty
Becaus eof Bitwise and

     0110 (6)
&     0001 0010 (10)
    0010  (2)

So
0&0 0
0&1 0
1&0 0
1&1 1


On Mon, Aug 1, 2011 at 3:31 PM, Vijay Khandar wrote:

> main()
> {
> int a=6,b=10,x;
> x=a&b;
> printf("%d",x);
> }
>
> O/P=2
> Plz any one explain me ,how its come
>
> --
> 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, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
Regards
Rajeev N B 

"*Winners Don't do Different things , they do things Differently"*

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C-question

2011-07-28 Thread Vijay Khandar
Now got it Thanks...

On Wed, Jul 27, 2011 at 11:27 PM, rajeev bharshetty wrote:

> The output is 10101101
> consider it to be f(173) -> f(86) -> f(43) -> f(21) -> f(10) -> f(5) ->
> f(2) -> f(1)
>   1   0 110
> 1   01
>
> Hope you get the recursion there .
>
> On Wed, Jul 27, 2011 at 11:19 PM, Vijay Khandar 
> wrote:
>
>> #include
>> #include
>> int f(int n)
>> {
>> if(n<=1)
>> {
>> printf(" %d",n);
>> }
>> else
>> {
>> f(n/2);
>> printf(" %d",n%2);
>> }
>> }
>>
>> void main()
>> {
>> clrscr();
>> f(173);
>> getch();
>> }
>>
>> o/p-1 0 1 0 1 1 0 1
>> but i m getting  1 0 1 1 0 1 0 1
>>
>> plz explain me...
>>
>> --
>> 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, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>>
>
>
> --
> Regards
> Rajeev N B 
>
> "*Winners Don't do Different things , they do things Differently"*
>
>  --
> 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, 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 algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C-question

2011-07-27 Thread Lakshman baale
@vijay

put return n int function f(),
you will get expected out put.
as like this...

#include
#include
int f(int n)
{
if(n<=1)
{
printf(" %d",n);
return n;
}
else
{
f(n/2);
printf(" %d",n%2);
return n;
}
}

void main()
{
clrscr();
f(173);
getch();
}

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C-question

2011-07-27 Thread rajeev bharshetty
The output is 10101101
consider it to be f(173) -> f(86) -> f(43) -> f(21) -> f(10) -> f(5) -> f(2)
-> f(1)
  1   0 110
1   01

Hope you get the recursion there .

On Wed, Jul 27, 2011 at 11:19 PM, Vijay Khandar wrote:

> #include
> #include
> int f(int n)
> {
> if(n<=1)
> {
> printf(" %d",n);
> }
> else
> {
> f(n/2);
> printf(" %d",n%2);
> }
> }
>
> void main()
> {
> clrscr();
> f(173);
> getch();
> }
>
> o/p-1 0 1 0 1 1 0 1
> but i m getting  1 0 1 1 0 1 0 1
>
> plz explain me...
>
> --
> 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, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
Regards
Rajeev N B 

"*Winners Don't do Different things , they do things Differently"*

-- 
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, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C-question

2011-07-27 Thread Vijay Khandar
Can  u explain me plz

On Wed, Jul 27, 2011 at 11:24 PM, Muthu Raj  wrote:

> I am getting the proper output :) 1 0 1 0 1 1 0 1
>
>
>
>
> *Muthuraj R.
> 4TH Year BE.**
> Information Science Dept*
> *PESIT, Bengaluru .
> *
>
>
>
>
> On Wed, Jul 27, 2011 at 11:19 PM, Vijay Khandar 
> wrote:
>
>> #include
>> #include
>> int f(int n)
>> {
>> if(n<=1)
>> {
>> printf(" %d",n);
>> }
>> else
>> {
>> f(n/2);
>> printf(" %d",n%2);
>> }
>> }
>>
>> void main()
>> {
>> clrscr();
>> f(173);
>> getch();
>> }
>>
>> o/p-1 0 1 0 1 1 0 1
>> but i m getting  1 0 1 1 0 1 0 1
>>
>> plz explain me...
>>
>> --
>> 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, 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 algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> 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 algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



  1   2   >