Bls: [algogeeks] what is the output????

2011-09-14 Thread Andi Dia


 
Ndua Gunung



Dari: Rohit Upadhyaya 
Kepada: algogeeks@googlegroups.com
Dikirim: Rabu, 14 September 2011 15:07
Judul: Re: [algogeeks] what is the output




can any1 explain me the fork() function???
-- 
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.
unsubscr...@googlegroups.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.



Re: [algogeeks] what is the output????

2011-09-14 Thread Rohit Upadhyaya
can any1 explain me the fork() function???

-- 
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] what is the output????

2011-09-14 Thread rahul vatsa
45 times

On Wed, Sep 14, 2011 at 3:35 AM, sharmila saru wrote:

> hello will be printed 9 times
>
> On Sun, Sep 11, 2011 at 3:25 AM, htross  wrote:
>
>> main()
>> {
>>int tmp;
>>for(i=0;i<9;i++)
>>{
>>tmp=fork();
>>if(tmp>0)
>>break;
>>printf("Hello");
>>}
>> }
>>
>> --
>> 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] what is the output????

2011-09-14 Thread sharmila saru
hello will be printed 9 times

On Sun, Sep 11, 2011 at 3:25 AM, htross  wrote:

> main()
> {
>int tmp;
>for(i=0;i<9;i++)
>{
>tmp=fork();
>if(tmp>0)
>break;
>printf("Hello");
>}
> }
>
> --
> 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] what is the output????

2011-09-11 Thread ravi maggon
Hello will be printed 9 times.

On Sun, Sep 11, 2011 at 3:25 AM, htross  wrote:

> main()
> {
>int tmp;
>for(i=0;i<9;i++)
>{
>tmp=fork();
>if(tmp>0)
>break;
>printf("Hello");
>}
> }
>
> --
> 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
Ravi Maggon
B.E. CSE, Final Year
Thapar University

www.algorithmguru.com

"*Failure is the opportunity to begin again more intelligently"*

-- 
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] what is the output????

2011-09-10 Thread htross
main()
{
int tmp;
for(i=0;i<9;i++)
{
tmp=fork();
if(tmp>0)
break;
printf("Hello");
}
}

-- 
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] What is the Output?? and How??

2011-09-07 Thread nagarajan
please can u explain.. or copy the explained content???

On Wed, Sep 7, 2011 at 11:03 PM, sukran dhawan wrote:

> its already been explained in previous thread
>
> On Wed, Sep 7, 2011 at 11:01 PM, NAGARAJAN SIVARAMAN 
> wrote:
>
>> #include
>> #include
>> #define prn(a) printf("%d ",a)
>> #define print(a,b,c) prn(a),prn(b),prn(c)
>> #define max(a,b) (a> void main()
>> {
>>
>>int x=1,y=2;
>>clrscr();
>>print(max(x++,y),x,y);
>> printf("\n%d %d\n",x,y);
>>print(max(x++,y),x,y);
>>printf("\n%d %d\n",x,y);
>>
>>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.
>>
>>
>  --
> 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.



Re: [algogeeks] What is the Output?? and How??

2011-09-07 Thread sukran dhawan
its already been explained in previous thread
On Wed, Sep 7, 2011 at 11:01 PM, NAGARAJAN SIVARAMAN wrote:

> #include
> #include
> #define prn(a) printf("%d ",a)
> #define print(a,b,c) prn(a),prn(b),prn(c)
> #define max(a,b) (a void main()
> {
>
>int x=1,y=2;
>clrscr();
>print(max(x++,y),x,y);
> printf("\n%d %d\n",x,y);
>print(max(x++,y),x,y);
>printf("\n%d %d\n",x,y);
>
>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.
>
>

-- 
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] What is the Output?? and How??

2011-09-07 Thread NAGARAJAN SIVARAMAN
#include
#include
#define prn(a) printf("%d ",a)
#define print(a,b,c) prn(a),prn(b),prn(c)
#define max(a,b) (ahttp://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] What is the output and how ???

2011-08-26 Thread Vijay Khandar
O\P= 1 2 1 3 1 2 1 is it correct?

On Fri, Aug 26, 2011 at 12:23 PM, SAMMM  wrote:

> include
> void fun(int);
> typedef int (*pf) (int, int);
> int proc(pf, int, int);
>
> int main()
> {
>int a=3;
>fun(a);
>return 0;
> }
> void fun(int n)
> {
>if(n > 0)
>{
>fun(--n);
>printf("%d,", n);
>fun(--n);
>}
> }
>
> --
> 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] What is the output and how ???

2011-08-25 Thread SAMMM
include
void fun(int);
typedef int (*pf) (int, int);
int proc(pf, int, int);

int main()
{
int a=3;
fun(a);
return 0;
}
void fun(int n)
{
if(n > 0)
{
fun(--n);
printf("%d,", n);
fun(--n);
}
}

-- 
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] What is the output of the following program? Why?

2011-07-17 Thread Shubham Maheshwari
i wasnt sure abt the first part of it.
the one with multiple initializations ...
:P

On Sun, Jul 17, 2011 at 3:09 AM, sagar pareek  wrote:

> Well shubham if you know about the unions very well then why u asked this
> question?
>
>
> On Sun, Jul 17, 2011 at 2:27 AM, Shubham Maheshwari <
> shubham.veloc...@gmail.com> wrote:
>
>> :D
>>
>>
>> On Sun, Jul 17, 2011 at 2:24 AM, Kamakshii Aggarwal <
>> kamakshi...@gmail.com> wrote:
>>
>>> @shubham:yes u r right.thanks :)
>>>
>>>
>>> On Sun, Jul 17, 2011 at 2:12 AM, Shubham Maheshwari <
>>> shubham.veloc...@gmail.com> wrote:
>>>
 @Kamakshii:
 thats probably becuz a union has a common memory location, accessed by
 all its members.
 so, the value '100' is treated as an int by 'a', as a char array by 'b'
 and as a float by 'c'.
 I thnk i read this read tis somewhere sometime back. ... so aint
 completely sure abt it.


 On Sun, Jul 17, 2011 at 2:08 AM, Kamakshii Aggarwal <
 kamakshi...@gmail.com> wrote:

>
> u can always retrieve that value from the union that has been assigned
> last.therefore u get correct answer only for x.c
>
> in the case of union y
> y.a=100 and so the output
> but am not sure why y.b is printing character equivalent of 100.
>
>
> On Sun, Jul 17, 2011 at 1:58 AM, Shubham Maheshwari <
> shubham.veloc...@gmail.com> wrote:
>
>> you mean to say .. the ques is wrong ... or what ...!!
>>
>>
>> On Sun, Jul 17, 2011 at 1:54 AM, sagar pareek 
>> wrote:
>>
>>> I think you must first read about unions and the differences between
>>> union and structures :)
>>>
>>> On Sun, Jul 17, 2011 at 1:48 AM, Shubham Maheshwari <
>>> shubham.veloc...@gmail.com> wrote:
>>>
 "union" Data Type
 What is the output of the following program? Why?
 #include
 main() {
 typedef union {
 int a;
 char b[10];
 float c;
 }
 Union;
 Union x,y = {100};
 x.a = 50;
 strcpy(x.b,"hello");
 x.c = 21.50;
 printf("Union x : %d %s %f n",x.a,x.b,x.c);
 printf("Union y : %d %s %f n",y.a,y.b,y.c);
 }

 --
 Shubham Maheshwari
 ShubZz
 O.o o.O

 enJoY ...!!!

  --
 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.
>>>
>>
>>
>>
>> --
>> Shubham Maheshwari
>> ShubZz
>> O.o o.O
>>
>> enJoY ...!!!
>>
>>  --
>> 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,
> Kamakshi
> kamakshi...@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.
>



 --
 Shubham Maheshwari
 ShubZz
 O.o o.O

 enJoY ...!!!

  --
 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,
>>> Kamakshi
>>> kamakshi...@gmail.com
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks

Re: [algogeeks] What is the output of the following program? Why?

2011-07-16 Thread sagar pareek
Well shubham if you know about the unions very well then why u asked this
question?

On Sun, Jul 17, 2011 at 2:27 AM, Shubham Maheshwari <
shubham.veloc...@gmail.com> wrote:

> :D
>
>
> On Sun, Jul 17, 2011 at 2:24 AM, Kamakshii Aggarwal  > wrote:
>
>> @shubham:yes u r right.thanks :)
>>
>>
>> On Sun, Jul 17, 2011 at 2:12 AM, Shubham Maheshwari <
>> shubham.veloc...@gmail.com> wrote:
>>
>>> @Kamakshii:
>>> thats probably becuz a union has a common memory location, accessed by
>>> all its members.
>>> so, the value '100' is treated as an int by 'a', as a char array by 'b'
>>> and as a float by 'c'.
>>> I thnk i read this read tis somewhere sometime back. ... so aint
>>> completely sure abt it.
>>>
>>>
>>> On Sun, Jul 17, 2011 at 2:08 AM, Kamakshii Aggarwal <
>>> kamakshi...@gmail.com> wrote:
>>>

 u can always retrieve that value from the union that has been assigned
 last.therefore u get correct answer only for x.c

 in the case of union y
 y.a=100 and so the output
 but am not sure why y.b is printing character equivalent of 100.


 On Sun, Jul 17, 2011 at 1:58 AM, Shubham Maheshwari <
 shubham.veloc...@gmail.com> wrote:

> you mean to say .. the ques is wrong ... or what ...!!
>
>
> On Sun, Jul 17, 2011 at 1:54 AM, sagar pareek 
> wrote:
>
>> I think you must first read about unions and the differences between
>> union and structures :)
>>
>> On Sun, Jul 17, 2011 at 1:48 AM, Shubham Maheshwari <
>> shubham.veloc...@gmail.com> wrote:
>>
>>> "union" Data Type
>>> What is the output of the following program? Why?
>>> #include
>>> main() {
>>> typedef union {
>>> int a;
>>> char b[10];
>>> float c;
>>> }
>>> Union;
>>> Union x,y = {100};
>>> x.a = 50;
>>> strcpy(x.b,"hello");
>>> x.c = 21.50;
>>> printf("Union x : %d %s %f n",x.a,x.b,x.c);
>>> printf("Union y : %d %s %f n",y.a,y.b,y.c);
>>> }
>>>
>>> --
>>> Shubham Maheshwari
>>> ShubZz
>>> O.o o.O
>>>
>>> enJoY ...!!!
>>>
>>>  --
>>> 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.
>>
>
>
>
> --
> Shubham Maheshwari
> ShubZz
> O.o o.O
>
> enJoY ...!!!
>
>  --
> 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,
 Kamakshi
 kamakshi...@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.

>>>
>>>
>>>
>>> --
>>> Shubham Maheshwari
>>> ShubZz
>>> O.o o.O
>>>
>>> enJoY ...!!!
>>>
>>>  --
>>> 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,
>> Kamakshi
>> kamakshi...@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.
>>
>
>
>
> --
> Shubham Maheshwari
> ShubZz
> O.o o.O
>
> enJoY ...!!!
>
>  --
> 

Re: [algogeeks] What is the output of the following program? Why?

2011-07-16 Thread Shubham Maheshwari
:D

On Sun, Jul 17, 2011 at 2:24 AM, Kamakshii Aggarwal
wrote:

> @shubham:yes u r right.thanks :)
>
>
> On Sun, Jul 17, 2011 at 2:12 AM, Shubham Maheshwari <
> shubham.veloc...@gmail.com> wrote:
>
>> @Kamakshii:
>> thats probably becuz a union has a common memory location, accessed by all
>> its members.
>> so, the value '100' is treated as an int by 'a', as a char array by 'b'
>> and as a float by 'c'.
>> I thnk i read this read tis somewhere sometime back. ... so aint
>> completely sure abt it.
>>
>>
>> On Sun, Jul 17, 2011 at 2:08 AM, Kamakshii Aggarwal <
>> kamakshi...@gmail.com> wrote:
>>
>>>
>>> u can always retrieve that value from the union that has been assigned
>>> last.therefore u get correct answer only for x.c
>>>
>>> in the case of union y
>>> y.a=100 and so the output
>>> but am not sure why y.b is printing character equivalent of 100.
>>>
>>>
>>> On Sun, Jul 17, 2011 at 1:58 AM, Shubham Maheshwari <
>>> shubham.veloc...@gmail.com> wrote:
>>>
 you mean to say .. the ques is wrong ... or what ...!!


 On Sun, Jul 17, 2011 at 1:54 AM, sagar pareek wrote:

> I think you must first read about unions and the differences between
> union and structures :)
>
> On Sun, Jul 17, 2011 at 1:48 AM, Shubham Maheshwari <
> shubham.veloc...@gmail.com> wrote:
>
>> "union" Data Type
>> What is the output of the following program? Why?
>> #include
>> main() {
>> typedef union {
>> int a;
>> char b[10];
>> float c;
>> }
>> Union;
>> Union x,y = {100};
>> x.a = 50;
>> strcpy(x.b,"hello");
>> x.c = 21.50;
>> printf("Union x : %d %s %f n",x.a,x.b,x.c);
>> printf("Union y : %d %s %f n",y.a,y.b,y.c);
>> }
>>
>> --
>> Shubham Maheshwari
>> ShubZz
>> O.o o.O
>>
>> enJoY ...!!!
>>
>>  --
>> 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.
>



 --
 Shubham Maheshwari
 ShubZz
 O.o o.O

 enJoY ...!!!

  --
 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,
>>> Kamakshi
>>> kamakshi...@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.
>>>
>>
>>
>>
>> --
>> Shubham Maheshwari
>> ShubZz
>> O.o o.O
>>
>> enJoY ...!!!
>>
>>  --
>> 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,
> Kamakshi
> kamakshi...@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.
>



-- 
Shubham Maheshwari
ShubZz
O.o o.O

enJoY ...!!!

-- 
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] What is the output of the following program? Why?

2011-07-16 Thread Kamakshii Aggarwal
@shubham:yes u r right.thanks :)

On Sun, Jul 17, 2011 at 2:12 AM, Shubham Maheshwari <
shubham.veloc...@gmail.com> wrote:

> @Kamakshii:
> thats probably becuz a union has a common memory location, accessed by all
> its members.
> so, the value '100' is treated as an int by 'a', as a char array by 'b' and
> as a float by 'c'.
> I thnk i read this read tis somewhere sometime back. ... so aint completely
> sure abt it.
>
>
> On Sun, Jul 17, 2011 at 2:08 AM, Kamakshii Aggarwal  > wrote:
>
>>
>> u can always retrieve that value from the union that has been assigned
>> last.therefore u get correct answer only for x.c
>>
>> in the case of union y
>> y.a=100 and so the output
>> but am not sure why y.b is printing character equivalent of 100.
>>
>>
>> On Sun, Jul 17, 2011 at 1:58 AM, Shubham Maheshwari <
>> shubham.veloc...@gmail.com> wrote:
>>
>>> you mean to say .. the ques is wrong ... or what ...!!
>>>
>>>
>>> On Sun, Jul 17, 2011 at 1:54 AM, sagar pareek wrote:
>>>
 I think you must first read about unions and the differences between
 union and structures :)

 On Sun, Jul 17, 2011 at 1:48 AM, Shubham Maheshwari <
 shubham.veloc...@gmail.com> wrote:

> "union" Data Type
> What is the output of the following program? Why?
> #include
> main() {
> typedef union {
> int a;
> char b[10];
> float c;
> }
> Union;
> Union x,y = {100};
> x.a = 50;
> strcpy(x.b,"hello");
> x.c = 21.50;
> printf("Union x : %d %s %f n",x.a,x.b,x.c);
> printf("Union y : %d %s %f n",y.a,y.b,y.c);
> }
>
> --
> Shubham Maheshwari
> ShubZz
> O.o o.O
>
> enJoY ...!!!
>
>  --
> 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.

>>>
>>>
>>>
>>> --
>>> Shubham Maheshwari
>>> ShubZz
>>> O.o o.O
>>>
>>> enJoY ...!!!
>>>
>>>  --
>>> 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,
>> Kamakshi
>> kamakshi...@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.
>>
>
>
>
> --
> Shubham Maheshwari
> ShubZz
> O.o o.O
>
> enJoY ...!!!
>
>  --
> 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,
Kamakshi
kamakshi...@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.



Re: [algogeeks] What is the output of the following program? Why?

2011-07-16 Thread Shubham Maheshwari
@Kamakshii:
thats probably becuz a union has a common memory location, accessed by all
its members.
so, the value '100' is treated as an int by 'a', as a char array by 'b' and
as a float by 'c'.
I thnk i read this read tis somewhere sometime back. ... so aint completely
sure abt it.

On Sun, Jul 17, 2011 at 2:08 AM, Kamakshii Aggarwal
wrote:

>
> u can always retrieve that value from the union that has been assigned
> last.therefore u get correct answer only for x.c
>
> in the case of union y
> y.a=100 and so the output
> but am not sure why y.b is printing character equivalent of 100.
>
>
> On Sun, Jul 17, 2011 at 1:58 AM, Shubham Maheshwari <
> shubham.veloc...@gmail.com> wrote:
>
>> you mean to say .. the ques is wrong ... or what ...!!
>>
>>
>> On Sun, Jul 17, 2011 at 1:54 AM, sagar pareek wrote:
>>
>>> I think you must first read about unions and the differences between
>>> union and structures :)
>>>
>>> On Sun, Jul 17, 2011 at 1:48 AM, Shubham Maheshwari <
>>> shubham.veloc...@gmail.com> wrote:
>>>
 "union" Data Type
 What is the output of the following program? Why?
 #include
 main() {
 typedef union {
 int a;
 char b[10];
 float c;
 }
 Union;
 Union x,y = {100};
 x.a = 50;
 strcpy(x.b,"hello");
 x.c = 21.50;
 printf("Union x : %d %s %f n",x.a,x.b,x.c);
 printf("Union y : %d %s %f n",y.a,y.b,y.c);
 }

 --
 Shubham Maheshwari
 ShubZz
 O.o o.O

 enJoY ...!!!

  --
 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.
>>>
>>
>>
>>
>> --
>> Shubham Maheshwari
>> ShubZz
>> O.o o.O
>>
>> enJoY ...!!!
>>
>>  --
>> 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,
> Kamakshi
> kamakshi...@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.
>



-- 
Shubham Maheshwari
ShubZz
O.o o.O

enJoY ...!!!

-- 
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] What is the output of the following program? Why?

2011-07-16 Thread Kamakshii Aggarwal
u can always retrieve that value from the union that has been assigned
last.therefore u get correct answer only for x.c

in the case of union y
y.a=100 and so the output
but am not sure why y.b is printing character equivalent of 100.


On Sun, Jul 17, 2011 at 1:58 AM, Shubham Maheshwari <
shubham.veloc...@gmail.com> wrote:

> you mean to say .. the ques is wrong ... or what ...!!
>
>
> On Sun, Jul 17, 2011 at 1:54 AM, sagar pareek wrote:
>
>> I think you must first read about unions and the differences between union
>> and structures :)
>>
>> On Sun, Jul 17, 2011 at 1:48 AM, Shubham Maheshwari <
>> shubham.veloc...@gmail.com> wrote:
>>
>>> "union" Data Type
>>> What is the output of the following program? Why?
>>> #include
>>> main() {
>>> typedef union {
>>> int a;
>>> char b[10];
>>> float c;
>>> }
>>> Union;
>>> Union x,y = {100};
>>> x.a = 50;
>>> strcpy(x.b,"hello");
>>> x.c = 21.50;
>>> printf("Union x : %d %s %f n",x.a,x.b,x.c);
>>> printf("Union y : %d %s %f n",y.a,y.b,y.c);
>>> }
>>>
>>> --
>>> Shubham Maheshwari
>>> ShubZz
>>> O.o o.O
>>>
>>> enJoY ...!!!
>>>
>>>  --
>>> 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.
>>
>
>
>
> --
> Shubham Maheshwari
> ShubZz
> O.o o.O
>
> enJoY ...!!!
>
>  --
> 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,
Kamakshi
kamakshi...@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.



Re: [algogeeks] What is the output of the following program? Why?

2011-07-16 Thread Shubham Maheshwari
you mean to say .. the ques is wrong ... or what ...!!

On Sun, Jul 17, 2011 at 1:54 AM, sagar pareek  wrote:

> I think you must first read about unions and the differences between union
> and structures :)
>
> On Sun, Jul 17, 2011 at 1:48 AM, Shubham Maheshwari <
> shubham.veloc...@gmail.com> wrote:
>
>> "union" Data Type
>> What is the output of the following program? Why?
>> #include
>> main() {
>> typedef union {
>> int a;
>> char b[10];
>> float c;
>> }
>> Union;
>> Union x,y = {100};
>> x.a = 50;
>> strcpy(x.b,"hello");
>> x.c = 21.50;
>> printf("Union x : %d %s %f n",x.a,x.b,x.c);
>> printf("Union y : %d %s %f n",y.a,y.b,y.c);
>> }
>>
>> --
>> Shubham Maheshwari
>> ShubZz
>> O.o o.O
>>
>> enJoY ...!!!
>>
>>  --
>> 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.
>



-- 
Shubham Maheshwari
ShubZz
O.o o.O

enJoY ...!!!

-- 
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] What is the output of the following program? Why?

2011-07-16 Thread sagar pareek
I think you must first read about unions and the differences between union
and structures :)

On Sun, Jul 17, 2011 at 1:48 AM, Shubham Maheshwari <
shubham.veloc...@gmail.com> wrote:

> "union" Data Type
> What is the output of the following program? Why?
> #include
> main() {
> typedef union {
> int a;
> char b[10];
> float c;
> }
> Union;
> Union x,y = {100};
> x.a = 50;
> strcpy(x.b,"hello");
> x.c = 21.50;
> printf("Union x : %d %s %f n",x.a,x.b,x.c);
> printf("Union y : %d %s %f n",y.a,y.b,y.c);
> }
>
> --
> Shubham Maheshwari
> ShubZz
> O.o o.O
>
> enJoY ...!!!
>
>  --
> 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] What is the output of the following program? Why?

2011-07-16 Thread Shubham Maheshwari
"union" Data Type
What is the output of the following program? Why?
#include
main() {
typedef union {
int a;
char b[10];
float c;
}
Union;
Union x,y = {100};
x.a = 50;
strcpy(x.b,"hello");
x.c = 21.50;
printf("Union x : %d %s %f n",x.a,x.b,x.c);
printf("Union y : %d %s %f n",y.a,y.b,y.c);
}

-- 
Shubham Maheshwari
ShubZz
O.o o.O

enJoY ...!!!

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