Re: [algogeeks] output

2013-12-09 Thread Tamanna Afroze
i think because of &operator the program is working differently... also
there is four data value print operation..


On Mon, Dec 9, 2013 at 2:34 AM, Tamanna Afroze  wrote:

> I got some other outputs.. when line 6 isn't commented i got 3 1 2 3, i m
> using turbo c++ compiler..
>
>
> On Fri, Dec 6, 2013 at 8:17 AM, pawan yadav wrote:
>
>> Hi All,
>>
>> I'm not able to get output of following c program :
>>
>> #include
>>  main()
>>  {
>>  int a[] ={ 1,2,3,4,5,6,7};
>>  char c[] = {'a','x','h','o','k'};
>>  //printf("%u   %u\n", &a[3], &a[0]);  line 6
>>  printf("%d %d %d %d \n", (&a[3]-&a[0]));
>>  }
>>
>> If line 6 is commented, output :
>>
>> 3 1562814827 1869117537 0
>>
>> Confusion : why is there 4 output?   "(&a[3]-&a[0])" should give only one.
>>
>> if line 6 is not commented, output :
>>
>> 1554221244   1554221232
>> 3 1554221232 1309214001 64
>>
>>
>>
>> Can anybody please explain why/how these outputs are coming?
>>
>> Thanks,
>> Pawan.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to algogeeks+unsubscr...@googlegroups.com.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to algogeeks+unsubscr...@googlegroups.com.


Re: [algogeeks] output

2013-12-09 Thread Tamanna Afroze
I got some other outputs.. when line 6 isn't commented i got 3 1 2 3, i m
using turbo c++ compiler..


On Fri, Dec 6, 2013 at 8:17 AM, pawan yadav wrote:

> Hi All,
>
> I'm not able to get output of following c program :
>
> #include
>  main()
>  {
>  int a[] ={ 1,2,3,4,5,6,7};
>  char c[] = {'a','x','h','o','k'};
>  //printf("%u   %u\n", &a[3], &a[0]);  line 6
>  printf("%d %d %d %d \n", (&a[3]-&a[0]));
>  }
>
> If line 6 is commented, output :
>
> 3 1562814827 1869117537 0
>
> Confusion : why is there 4 output?   "(&a[3]-&a[0])" should give only one.
>
> if line 6 is not commented, output :
>
> 1554221244   1554221232
> 3 1554221232 1309214001 64
>
>
>
> Can anybody please explain why/how these outputs are coming?
>
> Thanks,
> Pawan.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to algogeeks+unsubscr...@googlegroups.com.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to algogeeks+unsubscr...@googlegroups.com.


[algogeeks] output

2013-12-06 Thread pawan yadav
Hi All,

I'm not able to get output of following c program :

#include
 main()
 {
 int a[] ={ 1,2,3,4,5,6,7};
 char c[] = {'a','x','h','o','k'};
 //printf("%u   %u\n", &a[3], &a[0]);  line 6
 printf("%d %d %d %d \n", (&a[3]-&a[0]));
 }

If line 6 is commented, output :

3 1562814827 1869117537 0

Confusion : why is there 4 output?   "(&a[3]-&a[0])" should give only one.

if line 6 is not commented, output :

1554221244   1554221232
3 1554221232 1309214001 64



Can anybody please explain why/how these outputs are coming?

Thanks,
Pawan.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to algogeeks+unsubscr...@googlegroups.com.


Re: [algogeeks] Output

2012-11-24 Thread Rushiraj Patel
As arithmetic operator has higher precedence than shifting operator , mask
will have 5th bit zero from left.

So it will deduct 16 from the input if 5th bit is set in the binary
representation of number.
so it will deduct 16 from 56 and 127..but not from 64

But its  just the procedural thing meaning i don't know..


On Sat, Nov 24, 2012 at 2:15 PM, rajesh pandey  wrote:

> void dosomething(int num)
> {
> int mask=~(1<<5-1);
>  int res=num&mask;
> printf("%d",res);
> }
> int main()
> {
> dosomething(56);
> dosomething(64);
> dosomething(127);
>  return 0;
> }
>
> please explain  the logic behind the output.
>
> Thanks,
> Rajesh
>
> --
>
>
>

-- 




[algogeeks] Output

2012-11-24 Thread rajesh pandey
void dosomething(int num)
{
int mask=~(1<<5-1);
int res=num&mask;
printf("%d",res);
}
int main()
{
dosomething(56);
dosomething(64);
dosomething(127);
return 0;
}

please explain  the logic behind the output.

Thanks,
Rajesh  

-- 




Re: [algogeeks] output of the program with explanation

2012-11-07 Thread vishwa
let me keep it simple

 y is integer pointer pointing to address 20 .. x=20

y+7 will point to the addressy + ( size(int) * 7) i.e  50 here
/*y is integer pointer*/

On Tue, Nov 6, 2012 at 11:45 AM, Rahul Kumar Patle <
patlerahulku...@gmail.com> wrote:

> because difference is of 30 bytes..
> and integer takes 4 byte...
> it is representing that there are 7 int blocks between the address x and y
> output will be same as 7 for 31, 30, 29, 28.
>
> 2012/11/6 rajesh pandey 
>
>> *int *x ,int *y;
>> x=(int *) 50;
>> y=(int *)20;
>> cout<>
>> why the output is 7.*
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msg/algogeeks/-/wgVXAzGRgU4J.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> Thanks and Regards:
> Rahul Kumar Patle
> M.Tech, School of Information Technology
> Indian Institute of Technology, Kharagpur-721302, 
> India
> Mobile No: +91-8798049298, +91-9424738542
> Alternate Email: rahulkumarpa...@hotmail.com
> [image: 
> Linkedin]
> [image: Twitter] 
> 
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
*Thanks & Regards,*
*Vishwa*
*+91 9964051504*

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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: Re: [algogeeks] output of the program with explanation

2012-11-06 Thread rajesh . pandey . iiit

@rahul thnx !!!

On , rahul patil  wrote:
its because it is integer pointer subtraction, So subtraction result will  
be divided by integer size.



so 30/4 = 7.



2012/11/6 rajesh pandey rajesh.pandey.i...@gmail.com>



int *x ,int *y;
x=(int *) 50;
y=(int *)20;
cout
why the output is 7.








--


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



To post to this group, send email to algogeeks@googlegroups.com.


To unsubscribe from 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,
Rahul Patil









--


You received this message because you are subscribed to the Google  
Groups "Algorithm Geeks" group.



To post to this group, send email to algogeeks@googlegroups.com.


To unsubscribe from 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] output of the program with explanation

2012-11-05 Thread rahul patil
its because it is integer pointer subtraction, So  subtraction  result will
be divided by integer size.

so 30/4 = 7.

2012/11/6 rajesh pandey 

> *int *x ,int *y;
> x=(int *) 50;
> y=(int *)20;
> cout<
> why the output is 7.*
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/algogeeks/-/wgVXAzGRgU4J.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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,
Rahul Patil

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] output of the program with explanation

2012-11-05 Thread rajesh pandey
*int *x ,int *y;
x=(int *) 50;
y=(int *)20;
cout

[algogeeks] output

2012-07-25 Thread jatin
 anybdy has basic trie implementation (insertion and printing) ?
o/p
1)
main()
{
char *p1="Name";
char *p2;
p2=(char *)malloc(20);
while(*p2++=*p1++);
printf("%s\n",p2);
} ...it's giving me empty string 
 
2)
i=5;
printf("%d",i++ * i++);
o/p and also tell the reason?

-- 
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/-/Wk5StwVUxQMJ.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] output C

2012-02-25 Thread atul anand
 0001,
 0010,
 0100,
these number are represented in octal ..so u r getting decimal of the same.
1000 -> this is a decimal value;

preceding number by "0" means you are representing it in octal format

similarly preceding "0x" means representing in hexa format.

On Sun, Feb 26, 2012 at 3:38 AM, Ravi Ranjan wrote:

> #include 
> #include 
>
> #define SIZEOF(arr) (sizeof(arr)/sizeof(arr[0]))
>
>   #define PrintInt(expr) printf("%s:%d\n",#expr,(expr))
>
> int main(int argc, char *argv[])
> {
>
>   /* The powers of 10 */
>   int pot[] = {
>   0001,
>   0010,
>   0100,
>   1000
>   };
>   int i;
>
>   for(i=0;iPrintInt(pot[i]);
>
>   system("PAUSE");
>   return 0;
> }
>
>
> howz dat output come plz explain??
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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] output C

2012-02-25 Thread Ravi Ranjan
#include 
#include 

#define SIZEOF(arr) (sizeof(arr)/sizeof(arr[0]))

  #define PrintInt(expr) printf("%s:%d\n",#expr,(expr))

int main(int argc, char *argv[])
{

  /* The powers of 10 */
  int pot[] = {
  0001,
  0010,
  0100,
  1000
  };
  int i;

  for(i=0;ihttp://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] output expalnation?

2011-09-26 Thread Ratan
On ideone.com its showing compiler error and on ubuntu garbage value
of b gets as the result...

On Tue, Sep 27, 2011 at 10:21 AM, gaurav yadav
 wrote:
> b=6 will not execute..
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Ratan Kumar
B. Tech
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] output expalnation?

2011-09-26 Thread gaurav yadav
b=6 will not execute..

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



Re: [algogeeks] output expalnation?

2011-09-26 Thread sukran dhawan
compile time error... except case labels nothing else will be executed in
case of switch statements... so definition of b will not be executed.so
compilation error

On Tue, Sep 27, 2011 at 6:28 AM, Ratan  wrote:

> #include
> int main()
> {
>int a=1;
>switch(a)
>{
> int b=6;
>case 1:
> printf("b is %d",b);
>break;
>default:
>printf("b is %d:",b);
>break;
>}
> return 0;
> }
>
> can any1 explain the o/p of this program...
>
>
>
>
>
> Thanxs n Regards
> --
> Ratan Modi
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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] output expalnation?

2011-09-26 Thread Ratan
#include
int main()
{
int a=1;
switch(a)
{
 int b=6;
case 1:
printf("b is %d",b);
break;
default:
printf("b is %d:",b);
break;
}
return 0;
}

can any1 explain the o/p of this program...





Thanxs n Regards
-- 
Ratan Modi

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] output

2011-09-13 Thread Kunal Patil
@Kumar: +1

@Kumar & Rajeshwar: ExitFailure is outputted because main is expected to
return something which is not done in your case. Just add return 0; at the
end of main to get expected output.

On Tue, Sep 13, 2011 at 11:33 PM, Ishan Aggarwal <
ishan.aggarwal.1...@gmail.com> wrote:

> int main()
> {printf("%s",printf("samsung")+fun());
> return 0;}fun(){return "electronic";}
>
>
>
>
> On Tue, Sep 13, 2011 at 11:28 PM, kumar raja wrote:
>
>> main(){printf("%s",printf("samsung")+fun());}fun(){return "electronic";}
>>
>> The printf is a function which returns the number of printed characters , 
>> and scanf is a function
>> which returns the number of inputs scanned .
>>
>> So after printing "samsung" it returns 7. fun() is returning a pointer to 
>> the constant string
>>
>>
>> "electronic" , so it is like 7["electronic"]
>>
>> so the %s prints that string from the 7th index onwards till end .
>>
>> So output is "nic"
>>
>> so the total output is "samsungnic"
>>
>>
>> but i dont know why it is exiting with some error code..
>>
>>
>>
>> On 13 September 2011 10:51, Rajeshwar Patra wrote:
>>
>>> http://codepad.org/erdnF74M
>>>
>>> can anyone explain the output ???
>>>
>>> --
>>> *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.
>>>
>>
>>
>>
>> --
>> Regards
>> Kumar Raja
>> M.Tech(SIT)
>> IIT Kharagpur,
>> 10it60...@iitkgp.ac.in
>> 7797137043.
>> 09491690115.
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> Kind Regards
> Ishan Aggarwal
> [image: Aricent Group]
> Presidency Tower-A, M.G.Road,Sector-14
> Gurgaon,Haryana.122015 INDIA
> Phone : +91-9654602663
> ishan2.aggar...@aricent.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] output

2011-09-13 Thread Ishan Aggarwal
int main(){printf("%s",printf("samsung")+fun());return 0;}fun(){return
"electronic";}




On Tue, Sep 13, 2011 at 11:28 PM, kumar raja wrote:

> main(){printf("%s",printf("samsung")+fun());}fun(){return "electronic";}
>
> The printf is a function which returns the number of printed characters , and 
> scanf is a function
> which returns the number of inputs scanned .
>
> So after printing "samsung" it returns 7. fun() is returning a pointer to the 
> constant string
>
> "electronic" , so it is like 7["electronic"]
>
> so the %s prints that string from the 7th index onwards till end .
>
> So output is "nic"
>
> so the total output is "samsungnic"
>
> but i dont know why it is exiting with some error code..
>
>
>
> On 13 September 2011 10:51, Rajeshwar Patra wrote:
>
>> http://codepad.org/erdnF74M
>>
>> can anyone explain the output ???
>>
>> --
>> *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.
>>
>
>
>
> --
> Regards
> Kumar Raja
> M.Tech(SIT)
> IIT Kharagpur,
> 10it60...@iitkgp.ac.in
> 7797137043.
> 09491690115.
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Kind Regards
Ishan Aggarwal
[image: Aricent Group]
Presidency Tower-A, M.G.Road,Sector-14
Gurgaon,Haryana.122015 INDIA
Phone : +91-9654602663
ishan2.aggar...@aricent.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] output

2011-09-13 Thread kumar raja
main(){printf("%s",printf("samsung")+fun());}fun(){return "electronic";}

The printf is a function which returns the number of printed
characters , and scanf is a function
which returns the number of inputs scanned .

So after printing "samsung" it returns 7. fun() is returning a pointer
to the constant string
"electronic" , so it is like 7["electronic"]

so the %s prints that string from the 7th index onwards till end .

So output is "nic"

so the total output is "samsungnic"
but i dont know why it is exiting with some error code..



On 13 September 2011 10:51, Rajeshwar Patra wrote:

> http://codepad.org/erdnF74M
>
> can anyone explain the output ???
>
> --
> *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.
>



-- 
Regards
Kumar Raja
M.Tech(SIT)
IIT Kharagpur,
10it60...@iitkgp.ac.in
7797137043.
09491690115.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] output

2011-09-13 Thread Rajeshwar Patra
http://codepad.org/erdnF74M

can anyone explain the output ???

-- 
*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] Output question

2011-08-22 Thread Abhishek
+1 to sagar.
@vartika: if you don't know the concept of Union then understanding this 
program will be quite lenghty, because it will involve lot of calculation. 
try to check some simple examples, like:

union a
{
int a;
char c;
};
int main()
{
 union a xy;
 xy.a=65;
 printf("%c",xy.c);
 xy.c=65;
 printf(" %d",xy.a);
return 0;
}

-- 
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/-/_FK5paJXWCEJ.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] Output question

2011-08-22 Thread sagar pareek
U should know that union's elements share memory alloted through the largest
data type like in this case 10 bytes is alloted and is shared by all the
union elements.

So in union x :- last element modified is c, so that's why it is printing
garbage values for int and char[] elements...
actually if u convert float value in binary then u will see that what's its
actual integer value is? same case for char[]

in union y : last modified element is integer thats y it is printing 100 for
integer... ascii value of 'd' is 100 thats y printing 'd' for char[] and
0.000 for float

On Mon, Aug 22, 2011 at 4:53 PM, vartika wrote:

> #include
> #include
> int 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);
>  return 0;
> }
>
> Someone pls explain the output
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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] Output question

2011-08-22 Thread vartika
#include
#include
int 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);
 return 0;
}

Someone pls explain the output

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] Output?? Why??

2011-08-17 Thread noobcoder
#include
int main()
{
  char arr[5] = "geeks";
  printf("%s", arr);
  getchar();
  return 0;
}

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] output

2011-08-12 Thread Anil Arya
Answer=:>  32

On Fri, Aug 12, 2011 at 8:05 PM, Avenged  wrote:

> this is the question :
>
> #include
> #define prn(a) printf("%d",a)
> #define print(a,b,c) prn(a), prn(b), prn(c)
> #define max(a,b) (a>b?a:b)
>
> int main()
> {
> int x=1, y=2;
> print(max(x++,y),x,y);
> print(max(x++,y),x,y);
> return 0;
> }
>
> --
> 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/-/bL-fhH-lTmQJ.
>
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Anil Kumar Arya
computer science & engineering

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] output

2011-08-12 Thread Avenged
this is the question :

#include
#define prn(a) printf("%d",a)
#define print(a,b,c) prn(a), prn(b), prn(c)
#define max(a,b) (a>b?a:b)

int main()
{
int x=1, y=2;
print(max(x++,y),x,y);
print(max(x++,y),x,y);
return 0;
}

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/bL-fhH-lTmQJ.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] output

2011-08-12 Thread sukran dhawan
macro has not been terminated and it has so many errors

On Thu, Aug 11, 2011 at 11:36 PM, manvir siyo  wrote:

>  output of the program?
>
> #define prn(a) printf("%d",a)
> #define print(a,b,c) prn(a), prn(b), prn(c)
> #define max(a,b) (a
>
> main()
> {
> int x=1, y=2;
> print(max(x++,y),x,y);
> print(max(x++,y),x,y);
> }
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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] output

2011-08-11 Thread mani walia
this is the question in de shaw written test

On Thu, Aug 11, 2011 at 11:48 PM, Anika Jain  wrote:

> this code has so many errors
>
> On Thu, Aug 11, 2011 at 11:36 PM, manvir siyo  wrote:
>
>>  output of the program?
>>
>> #define prn(a) printf("%d",a)
>> #define print(a,b,c) prn(a), prn(b), prn(c)
>> #define max(a,b) (a
>>
>> main()
>> {
>> int x=1, y=2;
>> print(max(x++,y),x,y);
>> print(max(x++,y),x,y);
>> }
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from 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] output

2011-08-11 Thread Anika Jain
this code has so many errors

On Thu, Aug 11, 2011 at 11:36 PM, manvir siyo  wrote:

>  output of the program?
>
> #define prn(a) printf("%d",a)
> #define print(a,b,c) prn(a), prn(b), prn(c)
> #define max(a,b) (a
>
> main()
> {
> int x=1, y=2;
> print(max(x++,y),x,y);
> print(max(x++,y),x,y);
> }
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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] output

2011-08-11 Thread manvir siyo
 output of the program?

#define prn(a) printf("%d",a)
#define print(a,b,c) prn(a), prn(b), prn(c)
#define max(a,b) (a

main()
{
int x=1, y=2;
print(max(x++,y),x,y);
print(max(x++,y),x,y);
}

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] output?

2011-08-10 Thread Arun Vishwanathan
@sandeep: so the statement becomes if(ch=0) since printf returns integer
0...whats does this mean now actually?0 is ascii for NULL and so ch is
assinged to null? I am slightly confused..

On Tue, Aug 9, 2011 at 7:04 PM, SANDEEP CHUGH wrote:

> @all sorry i give wrong explanation by mistake..:P :P
>
> printf("")  returns no if characters.. in this case returns 0 . which is
> assigned to ch
>
> so in ch 0 is stored and 0 is the ascii value of null character
> when we using ch in --- if (ch) --> it will reduce to if(0) -- as 0 is the
> ascii value of null character
>
> so the output "it doesn't matter"
>
>
> On Tue, Aug 9, 2011 at 10:28 PM, Dipankar Patro wrote:
>
>> o/p:
>> It doesn't matter
>>
>> Reason:
>> printf() returns the number of characters printed to screen.
>> since printf("") will return 0, hence the *else* is selected.
>>
>>
>> On 9 August 2011 22:25, siddharth srivastava  wrote:
>>
>>>
>>>
>>>  On 9 August 2011 22:20, tech rascal  wrote:
>>>
 #include
 int main()
 {
 char ch;
 if((ch=printf("")))
 printf("it matters");
 else
 printf("it doesn't matter");
 return 0;
 }


>>> It doesn't matter
>>>
>>>
>>>

 what will b the output??

 --
 You received this message because you are subscribed to the Google
 Groups "Algorithm Geeks" group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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.
>>>
>>
>>
>>
>> --
>>
>> ___
>>
>> 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.
>



-- 
 "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] output?

2011-08-09 Thread SANDEEP CHUGH
@all sorry i give wrong explanation by mistake..:P :P

printf("")  returns no if characters.. in this case returns 0 . which is
assigned to ch

so in ch 0 is stored and 0 is the ascii value of null character
when we using ch in --- if (ch) --> it will reduce to if(0) -- as 0 is the
ascii value of null character

so the output "it doesn't matter"

On Tue, Aug 9, 2011 at 10:28 PM, Dipankar Patro  wrote:

> o/p:
> It doesn't matter
>
> Reason:
> printf() returns the number of characters printed to screen.
> since printf("") will return 0, hence the *else* is selected.
>
>
> On 9 August 2011 22:25, siddharth srivastava  wrote:
>
>>
>>
>> On 9 August 2011 22:20, tech rascal  wrote:
>>
>>> #include
>>> int main()
>>> {
>>> char ch;
>>> if((ch=printf("")))
>>> printf("it matters");
>>> else
>>> printf("it doesn't matter");
>>> return 0;
>>> }
>>>
>>>
>> It doesn't matter
>>
>>
>>
>>>
>>> what will b the output??
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from 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.
>>
>
>
>
> --
>
> ___
>
> 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] output?

2011-08-09 Thread siddharth srivastava
my bad..that I didn't notice = (assumed it to be ==)

On 9 August 2011 22:28, SANDEEP CHUGH  wrote:

> it doesn't matter
>
> On Tue, Aug 9, 2011 at 10:25 PM, siddharth srivastava  > wrote:
>
>>
>>
>> On 9 August 2011 22:20, tech rascal  wrote:
>>
>>> #include
>>> int main()
>>> {
>>> char ch;
>>> if((ch=printf("")))
>>> printf("it matters");
>>> else
>>> printf("it doesn't matter");
>>> return 0;
>>> }
>>>
>>>
>> output wud be : It doesn't matter
>>
>
> reason:  in the printf("") ---> this will return null character and assign
> it to ch and null character has ascii value 0
>
> so statement reduces to
>
> if(0)
>
> rest u knw..
>
>
>
>>
>>
>>
>>>
>>> what will b the output??
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from 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] output?

2011-08-09 Thread SANDEEP CHUGH
it doesn't matter

On Tue, Aug 9, 2011 at 10:25 PM, siddharth srivastava
wrote:

>
>
> On 9 August 2011 22:20, tech rascal  wrote:
>
>> #include
>> int main()
>> {
>> char ch;
>> if((ch=printf("")))
>> printf("it matters");
>> else
>> printf("it doesn't matter");
>> return 0;
>> }
>>
>>
> output wud be : It doesn't matter
>

reason:  in the printf("") ---> this will return null character and assign
it to ch and null character has ascii value 0

so statement reduces to

if(0)

rest u knw..



>
>
>
>>
>> what will b the output??
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from 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] output?

2011-08-09 Thread Dipankar Patro
o/p:
It doesn't matter

Reason:
printf() returns the number of characters printed to screen.
since printf("") will return 0, hence the *else* is selected.

On 9 August 2011 22:25, siddharth srivastava  wrote:

>
>
> On 9 August 2011 22:20, tech rascal  wrote:
>
>> #include
>> int main()
>> {
>> char ch;
>> if((ch=printf("")))
>> printf("it matters");
>> else
>> printf("it doesn't matter");
>> return 0;
>> }
>>
>>
> It doesn't matter
>
>
>
>>
>> what will b the output??
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from 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.
>



-- 
___

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.



Re: [algogeeks] output?

2011-08-09 Thread Amol Sharma
printf returns the numbers of character printed and here it prints nothing
i.e. 0 characters hence returns 0

and hence "it doesnt matter" gets printed
--


Amol Sharma
Third Year Student
Computer Science and Engineering
MNNIT Allahabad




On Tue, Aug 9, 2011 at 10:25 PM, tech rascal wrote:

> explanation??
>
>
> On Tue, Aug 9, 2011 at 10:24 PM, aditi garg wrote:
>
>> it doesnt matter
>>
>> On Tue, Aug 9, 2011 at 10:20 PM, tech rascal wrote:
>>
>>> #include
>>> int main()
>>> {
>>> char ch;
>>> if((ch=printf("")))
>>> printf("it matters");
>>> else
>>> printf("it doesn't matter");
>>> return 0;
>>> }
>>>
>>>
>>> what will b the output??
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>
>>
>> --
>> Aditi Garg
>> Undergraduate Student
>> Electronics & Communication Divison
>> NETAJI SUBHAS INSTITUTE OF TECHNOLOGY
>> Sector 3, Dwarka
>> New 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.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] output?

2011-08-09 Thread siddharth srivastava
On 9 August 2011 22:25, tech rascal  wrote:

> explanation??
>
>
printf returns the no of characters printed
moreover you have an uninitialized char (with garbage value) so comparison
will always be false



>
> On Tue, Aug 9, 2011 at 10:24 PM, aditi garg wrote:
>
>> it doesnt matter
>>
>> On Tue, Aug 9, 2011 at 10:20 PM, tech rascal wrote:
>>
>>> #include
>>> int main()
>>> {
>>> char ch;
>>> if((ch=printf("")))
>>> printf("it matters");
>>> else
>>> printf("it doesn't matter");
>>> return 0;
>>> }
>>>
>>>
>>> what will b the output??
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>
>>
>> --
>> Aditi Garg
>> Undergraduate Student
>> Electronics & Communication Divison
>> NETAJI SUBHAS INSTITUTE OF TECHNOLOGY
>> Sector 3, Dwarka
>> New 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.
>



-- 
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] output?

2011-08-09 Thread Varun Jakhoria
it doesn't matter

On Tue, Aug 9, 2011 at 10:24 PM, Jayanthi shravan
 wrote:
>
>   it matters..
> On Tue, Aug 9, 2011 at 10:20 PM, tech rascal 
> wrote:
>>
>>
>>
>> what will b the output??
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>
>
>
> --
> shravan
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Varun Jakhoria
...it's only about 0's & 1'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] output?

2011-08-09 Thread siddharth srivastava
On 9 August 2011 22:20, tech rascal  wrote:

> #include
> int main()
> {
> char ch;
> if((ch=printf("")))
> printf("it matters");
> else
> printf("it doesn't matter");
> return 0;
> }
>
>
It doesn't matter



>
> what will b the output??
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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] output?

2011-08-09 Thread tech rascal
explanation??

On Tue, Aug 9, 2011 at 10:24 PM, aditi garg wrote:

> it doesnt matter
>
> On Tue, Aug 9, 2011 at 10:20 PM, tech rascal wrote:
>
>> #include
>> int main()
>> {
>> char ch;
>> if((ch=printf("")))
>> printf("it matters");
>> else
>> printf("it doesn't matter");
>> return 0;
>> }
>>
>>
>> what will b the output??
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> Aditi Garg
> Undergraduate Student
> Electronics & Communication Divison
> NETAJI SUBHAS INSTITUTE OF TECHNOLOGY
> Sector 3, Dwarka
> New 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] output?

2011-08-09 Thread Jayanthi shravan
  it matters..
On Tue, Aug 9, 2011 at 10:20 PM, tech rascal wrote:

>
>
>
> what will b the output??
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
shravan

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] output?

2011-08-09 Thread aditi garg
it doesnt matter

On Tue, Aug 9, 2011 at 10:20 PM, tech rascal wrote:

> #include
> int main()
> {
> char ch;
> if((ch=printf("")))
> printf("it matters");
> else
> printf("it doesn't matter");
> return 0;
> }
>
>
> what will b the output??
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Aditi Garg
Undergraduate Student
Electronics & Communication Divison
NETAJI SUBHAS INSTITUTE OF TECHNOLOGY
Sector 3, Dwarka
New 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] output?

2011-08-09 Thread tech rascal
#include
int main()
{
char ch;
if((ch=printf("")))
printf("it matters");
else
printf("it doesn't matter");
return 0;
}


what will b the output??

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] output help

2011-08-09 Thread SANDEEP CHUGH
i dnt get it.. any better explanation..

On Tue, Aug 9, 2011 at 1:13 PM, dinesh bansal  wrote:

> On a little-endian machine, bit structure will be represented as:
>
>  0x00 00 00 45
>
> which is bit.bit4 = 0010 (2 in decimal) bit.bit3 = 0010 (2 in decimal)
> bit.bit1 = 1 (1 in decimal)
>
> since bit.bit1 exists at the rightmost position, while displaying data as
> integer, compiler just repeats the same bit to all the remaining positions
> making it 0x (-1). You can confirm it while setting bit.bit1 to 0
>
> -Dinesh Bansal
>
>
> On Tue, Aug 9, 2011 at 12:24 PM, Rohit Srivastava 
> wrote:
>
>> #include
>> #include
>>
>> int main()
>> {
>> struct value
>> {
>> int bit1:1;
>> int bit3:4;
>> int bit4:4;
>> }bit={1,2,2};
>> printf("%d %d %d\n",bit.bit1,bit.bit3,bit.bit4);
>> getche();
>> return 0;
>> }
>>  the above code gives output : -1 2 2
>> any idea 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.
>>
>
>
>
> --
> Dinesh Bansal
> The Law of Win says, "Let's not do it your way or my way; let's do it the
> best way."
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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] output help

2011-08-09 Thread dinesh bansal
On a little-endian machine, bit structure will be represented as:

 0x00 00 00 45

which is bit.bit4 = 0010 (2 in decimal) bit.bit3 = 0010 (2 in decimal)
bit.bit1 = 1 (1 in decimal)

since bit.bit1 exists at the rightmost position, while displaying data as
integer, compiler just repeats the same bit to all the remaining positions
making it 0x (-1). You can confirm it while setting bit.bit1 to 0

-Dinesh Bansal

On Tue, Aug 9, 2011 at 12:24 PM, Rohit Srivastava wrote:

> #include
> #include
>
> int main()
> {
> struct value
> {
> int bit1:1;
> int bit3:4;
> int bit4:4;
> }bit={1,2,2};
> printf("%d %d %d\n",bit.bit1,bit.bit3,bit.bit4);
> getche();
> return 0;
> }
>  the above code gives output : -1 2 2
> any idea 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.
>



-- 
Dinesh Bansal
The Law of Win says, "Let's not do it your way or my way; let's do it the
best way."

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] output help

2011-08-09 Thread Rohit Srivastava
hey guys thanks got it!!


On Tue, Aug 9, 2011 at 12:49 PM, sanjay ahuja wrote:

> Int bit3:4 will be read as lower order 4 bits of bit3 and this will be
> treated as int (signed). Thus lower order bit of bit3 which is 2, are
> 0010 which is 2
> try with
> 1) int bit3:2, output will be -2
> 2) unsigned int bit3:2, output will be 2.
>
> I hope it is cleared now
>
> On 8/9/11, Rohit Srivastava  wrote:
> > #include
> > #include
> >
> > int main()
> > {
> > struct value
> > {
> > int bit1:1;
> > int bit3:4;
> > int bit4:4;
> > }bit={1,2,2};
> > printf("%d %d %d\n",bit.bit1,bit.bit3,bit.bit4);
> > getche();
> > return 0;
> > }
> >  the above code gives output : -1 2 2
> > any idea 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.
> >
> >
>
> --
> Sent from my mobile device
>
> Sanjay Ahuja,
> Analyst, Financing Prime Brokerage
> Nomura Securities India Pvt. Ltd
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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] output help

2011-08-09 Thread sanjay ahuja
Int bit3:4 will be read as lower order 4 bits of bit3 and this will be
treated as int (signed). Thus lower order bit of bit3 which is 2, are
0010 which is 2
try with
1) int bit3:2, output will be -2
2) unsigned int bit3:2, output will be 2.

I hope it is cleared now

On 8/9/11, Rohit Srivastava  wrote:
> #include
> #include
>
> int main()
> {
> struct value
> {
> int bit1:1;
> int bit3:4;
> int bit4:4;
> }bit={1,2,2};
> printf("%d %d %d\n",bit.bit1,bit.bit3,bit.bit4);
> getche();
> return 0;
> }
>  the above code gives output : -1 2 2
> any idea 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.
>
>

-- 
Sent from my mobile device

Sanjay Ahuja,
Analyst, Financing Prime Brokerage
Nomura Securities India Pvt. Ltd

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] output help

2011-08-09 Thread aditi garg
I think it is because bit1 is only 1 bit fwide and whn u initialize it to
1,since MSB is 1 it treats it as a negative integer...Plz correct me if i am
wrong...

On Tue, Aug 9, 2011 at 12:24 PM, Rohit Srivastava wrote:

> #include
> #include
>
> int main()
> {
> struct value
> {
> int bit1:1;
> int bit3:4;
> int bit4:4;
> }bit={1,2,2};
> printf("%d %d %d\n",bit.bit1,bit.bit3,bit.bit4);
> getche();
> return 0;
> }
>  the above code gives output : -1 2 2
> any idea 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.
>



-- 
Aditi Garg
Undergraduate Student
Electronics & Communication Divison
NETAJI SUBHAS INSTITUTE OF TECHNOLOGY
Sector 3, Dwarka
New 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] output help

2011-08-08 Thread Rohit Srivastava
#include
#include

int main()
{
struct value
{
int bit1:1;
int bit3:4;
int bit4:4;
}bit={1,2,2};
printf("%d %d %d\n",bit.bit1,bit.bit3,bit.bit4);
getche();
return 0;
}
 the above code gives output : -1 2 2
any idea 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] output help

2011-08-07 Thread Kamakshii Aggarwal
got it...thanks

On Mon, Aug 8, 2011 at 12:39 AM, aseem garg  wrote:

> typedef doesn't declare an instance of a variable, it declares a type (type
> alias actually),
>
> static is a qualifier you apply to an instance, not a type, so you can use
> static when you use the type, but not when you define the type.
> Aseem
>
>
>
> On Mon, Aug 8, 2011 at 12:29 AM, Kamakshii Aggarwal  > wrote:
>
>> #include
>> int main()
>> {
>>typedef static int *i;
>>   static int j;
>>   i a = &j;
>>   printf("%d", *a);
>>   getchar();
>>   return 0;
>> }
>>
>> what is the error in the code?
>> --
>> 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.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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] output help

2011-08-07 Thread aseem garg
typedef doesn't declare an instance of a variable, it declares a type (type
alias actually),

static is a qualifier you apply to an instance, not a type, so you can use
static when you use the type, but not when you define the type.
Aseem



On Mon, Aug 8, 2011 at 12:29 AM, Kamakshii Aggarwal
wrote:

> #include
> int main()
> {
>typedef static int *i;
>   static int j;
>   i a = &j;
>   printf("%d", *a);
>   getchar();
>   return 0;
> }
>
> what is the error in the code?
> --
> 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.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] output help

2011-08-07 Thread Amol Sharma
using typedef u define the static keyword as int
and the statement static int j thus becomes
int int j

hence the compiler gives the error "multiple storage class in declaration
specifiers"

--


Amol Sharma
Third Year Student
Computer Science and Engineering
MNNIT Allahabad




On Mon, Aug 8, 2011 at 12:29 AM, Kamakshii Aggarwal
wrote:

> #include
> int main()
> {
>typedef static int *i;
>   static int j;
>   i a = &j;
>   printf("%d", *a);
>   getchar();
>   return 0;
> }
>
> what is the error in the code?
> --
> 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.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] output help

2011-08-07 Thread Kamakshii Aggarwal
#include
int main()
{
   typedef static int *i;
  static int j;
  i a = &j;
  printf("%d", *a);
  getchar();
  return 0;
}

what is the error in the code?
-- 
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] OUTPUT????

2011-08-06 Thread Aditya Virmani
output wud be:
0.00
float value= 00.0
integer value=1
1 1 1 0.00

On Sat, Aug 6, 2011 at 2:49 PM, SHIVAM AGRAWAL  wrote:

> any1 plz tell me y output of float type of dis prgrm  is zero?
>
> #include
> #define INT 1
> main()
> {
> struct a
> {
> int type;
> };
> struct c
> {
> int type;
> int e;
> };
> struct b
> {
> int type;
> float f;
> };
> union
> {
> struct a n;
> struct b nf;
> struct c ni;
> }all;
> all.ni.type=INT;
> all.nf.f=10.43;
> all.ni.e=1;
> printf("%f\n",all.nf.f);
> if(all.nf.type==INT)
> printf("float value =%2.1f",all.nf.f);
> if(all.ni.type==INT)
> printf("\ninteger value=%d",all.ni.e);
> printf("\n%d %d %d %f",all.ni.type,all.nf.type,all.ni.e,all.nf.f);
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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] OUTPUT????

2011-08-06 Thread Ankit Minglani
out put is :
10.375001
float value =10.4
integer value=1
1 1 1 10.37500

what us the problem ?

On Sat, Aug 6, 2011 at 2:19 AM, SHIVAM AGRAWAL  wrote:

> any1 plz tell me y output of float type of dis prgrm  is zero?
>
> #include
> #define INT 1
> main()
> {
> struct a
> {
> int type;
> };
> struct c
> {
> int type;
> int e;
> };
> struct b
> {
> int type;
> float f;
> };
> union
> {
> struct a n;
> struct b nf;
> struct c ni;
> }all;
> all.ni.type=INT;
> all.nf.f=10.43;
> all.ni.e=1;
> printf("%f\n",all.nf.f);
> if(all.nf.type==INT)
> printf("float value =%2.1f",all.nf.f);
> if(all.ni.type==INT)
> printf("\ninteger value=%d",all.ni.e);
> printf("\n%d %d %d %f",all.ni.type,all.nf.type,all.ni.e,all.nf.f);
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
The more you sweat in the field, the less you bleed in war."

Ankit Minglani
NITK Surathkal

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] OUTPUT????

2011-08-06 Thread SHIVAM AGRAWAL
any1 plz tell me y output of float type of dis prgrm  is zero?

#include
#define INT 1
main()
{
struct a
{
int type;
};
struct c
{
int type;
int e;
};
struct b
{
int type;
float f;
};
union
{
struct a n;
struct b nf;
struct c ni;
}all;
all.ni.type=INT;
all.nf.f=10.43;
all.ni.e=1;
printf("%f\n",all.nf.f);
if(all.nf.type==INT)
printf("float value =%2.1f",all.nf.f);
if(all.ni.type==INT)
printf("\ninteger value=%d",all.ni.e);
printf("\n%d %d %d %f",all.ni.type,all.nf.type,all.ni.e,all.nf.f);

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] output

2011-08-05 Thread Pramod Jayswal
when swap is called ,as it is a macro ,before compilation its code is
replaced and the code before compilation bcomes:

> # define swap(a,b) temp=a; a=b; b=temp;
> main( )
> {
> int i, j, temp;
> i=5;
> j=10;
> temp=0;
> if( i > j)
>
   //code replaced here

> temp=a;   //not executed (false)
>
   a=b; //a=10(from b=10)
   b=temp;   //b=0 (from temp=0)

> printf( “%d %d %d”, i, j, temp);
> }
>
> and that is why u get output  10,0,0...
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] output

2011-08-05 Thread loka ranjane
@saurabh:ya got it..thanks

On Sat, Aug 6, 2011 at 10:26 AM, saurabh singh  wrote:
> Try compiling with gcc -E .That will clear everything
>
> On Sat, Aug 6, 2011 at 10:25 AM, saurabh singh  wrote:
>>
>> hint:MACRo is just substituted as it is
>>
>> On Sat, Aug 6, 2011 at 10:23 AM, ranjane  wrote:
>>>
>>> # define swap(a,b) temp=a; a=b; b=temp;
>>> main( )
>>> {
>>> int i, j, temp;
>>> i=5;
>>> j=10;
>>> temp=0;
>>> if( i > j)
>>> swap( i, j );
>>> printf( “%d %d %d”, i, j, temp);
>>> }
>>>
>>>
>>> On compiling i got ans 10, 0, 0.explain..
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from 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
>>
>>
>
>
>
> --
> 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] output

2011-08-05 Thread sagar pareek
Lets see what happen with ur code...

original
# define swap(a,b) temp=a; a=b; b=temp;
main( )
{
int i, j, temp;
i=5;
j=10;
temp=0;
if( i > j)
swap( i, j );
printf( “%d %d %d”, i, j, temp);
}


after expansion of macro

# define swap(a,b) temp=a; a=b; b=temp;
main( )
{
int i, j, temp;
i=5;
j=10;
temp=0;
if( i > j)
*temp=a;  //only this line comes under if condition*
a=b;
 b=temp;
printf( “%d %d %d”, i, j, temp);
}

On Sat, Aug 6, 2011 at 10:26 AM, saurabh singh  wrote:

> Try compiling with gcc -E .That will clear everything
>
>
> On Sat, Aug 6, 2011 at 10:25 AM, saurabh singh wrote:
>
>> hint:MACRo is just substituted as it is
>>
>>
>> On Sat, Aug 6, 2011 at 10:23 AM, ranjane  wrote:
>>
>>> # define swap(a,b) temp=a; a=b; b=temp;
>>> main( )
>>> {
>>> int i, j, temp;
>>> i=5;
>>> j=10;
>>> temp=0;
>>> if( i > j)
>>> swap( i, j );
>>> printf( “%d %d %d”, i, j, temp);
>>> }
>>>
>>>
>>> On compiling i got ans 10, 0, 0.explain..
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from 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
>>
>>
>>
>
>
> --
> 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.
>



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



Re: [algogeeks] output

2011-08-05 Thread saurabh singh
Try compiling with gcc -E .That will clear everything

On Sat, Aug 6, 2011 at 10:25 AM, saurabh singh  wrote:

> hint:MACRo is just substituted as it is
>
>
> On Sat, Aug 6, 2011 at 10:23 AM, ranjane  wrote:
>
>> # define swap(a,b) temp=a; a=b; b=temp;
>> main( )
>> {
>> int i, j, temp;
>> i=5;
>> j=10;
>> temp=0;
>> if( i > j)
>> swap( i, j );
>> printf( “%d %d %d”, i, j, temp);
>> }
>>
>>
>> On compiling i got ans 10, 0, 0.explain..
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from 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
>
>
>


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



Re: [algogeeks] output

2011-08-05 Thread saurabh singh
hint:MACRo is just substituted as it is

On Sat, Aug 6, 2011 at 10:23 AM, ranjane  wrote:

> # define swap(a,b) temp=a; a=b; b=temp;
> main( )
> {
> int i, j, temp;
> i=5;
> j=10;
> temp=0;
> if( i > j)
> swap( i, j );
> printf( “%d %d %d”, i, j, temp);
> }
>
>
> On compiling i got ans 10, 0, 0.explain..
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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] output

2011-08-05 Thread ranjane
# define swap(a,b) temp=a; a=b; b=temp;
main( )
{
int i, j, temp;
i=5;
j=10;
temp=0;
if( i > j)
swap( i, j );
printf( “%d %d %d”, i, j, temp);
}


On compiling i got ans 10, 0, 0.explain..

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] output???

2011-08-05 Thread sagar pareek
ha ha
its not like it stores slightly less than actual  :P :P

try this

float a=0.5,b=1.0,c=0.7;

if(0.5==a)
printf("yes a=0.5\n");

if(1.0==b)
printf("yes b=1.0\n");

if(0.7!=c)
printf("Yes c!=0.7\n");

o/p will be
yes a=0.5
yes b=1.0
yes c!=0.7

check it out i will explain it later...
On Fri, Aug 5, 2011 at 9:26 PM, Rajesh Kumar wrote:

> Thanks to all
>
>
> On Fri, Aug 5, 2011 at 8:53 PM, sukran dhawan wrote:
>
>> coz by default all real values are converted to double and it is larger
>> than float.ie real nos are not stored accurately inside computer
>> memory.so
>> since double occupies more memory it prints hi
>>
>>
>> On Fri, Aug 5, 2011 at 8:24 PM, Kamakshii Aggarwal > > wrote:
>>
>>> the reason is dat 0.7 is treated as double..therefore double(0.7)
>>> >float(0.7)
>>>
>>> On Fri, Aug 5, 2011 at 8:20 PM, kartik sachan 
>>> wrote:
>>>
 the output will be hi

 even if u have putted equal to sign there this is becoz 0.7 do not
 exactly stored like 0.7 in a but some thing lesser as describe in ASCII
 format
 that's why it is awlays lesser than 0.7

  --
 You received this message because you are subscribed to the Google
 Groups "Algorithm Geeks" group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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.
>>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from 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
> Rajesh Kumar
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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.



Re: [algogeeks] output???

2011-08-05 Thread Rajesh Kumar
Thanks to all

On Fri, Aug 5, 2011 at 8:53 PM, sukran dhawan wrote:

> coz by default all real values are converted to double and it is larger
> than float.ie real nos are not stored accurately inside computer memory.so
> since double occupies more memory it prints hi
>
>
> On Fri, Aug 5, 2011 at 8:24 PM, Kamakshii Aggarwal 
> wrote:
>
>> the reason is dat 0.7 is treated as double..therefore double(0.7)
>> >float(0.7)
>>
>> On Fri, Aug 5, 2011 at 8:20 PM, kartik sachan wrote:
>>
>>> the output will be hi
>>>
>>> even if u have putted equal to sign there this is becoz 0.7 do not
>>> exactly stored like 0.7 in a but some thing lesser as describe in ASCII
>>> format
>>> that's why it is awlays lesser than 0.7
>>>
>>>  --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from 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.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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
Rajesh Kumar

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] output???

2011-08-05 Thread sukran dhawan
coz by default all real values are converted to double and it is larger than
float.ie real nos are not stored accurately inside computer memory.so
since double occupies more memory it prints hi

On Fri, Aug 5, 2011 at 8:24 PM, Kamakshii Aggarwal wrote:

> the reason is dat 0.7 is treated as double..therefore double(0.7)
> >float(0.7)
>
> On Fri, Aug 5, 2011 at 8:20 PM, kartik sachan wrote:
>
>> the output will be hi
>>
>> even if u have putted equal to sign there this is becoz 0.7 do not exactly
>> stored like 0.7 in a but some thing lesser as describe in ASCII format
>> that's why it is awlays lesser than 0.7
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from 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.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] output???

2011-08-05 Thread Kamakshii Aggarwal
the reason is dat 0.7 is treated as double..therefore double(0.7)
>float(0.7)

On Fri, Aug 5, 2011 at 8:20 PM, kartik sachan wrote:

> the output will be hi
>
> even if u have putted equal to sign there this is becoz 0.7 do not exactly
> stored like 0.7 in a but some thing lesser as describe in ASCII format
> that's why it is awlays lesser than 0.7
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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] output???

2011-08-05 Thread bagaria.ka...@gmail.com
.7 in float is taken like .699 i blv ?

On Fri, Aug 5, 2011 at 8:20 PM, kartik sachan wrote:

> the output will be hi
>
> even if u have putted equal to sign there this is becoz 0.7 do not exactly
> stored like 0.7 in a but some thing lesser as describe in ASCII format
> that's why it is awlays lesser than 0.7
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Thanks and Regards

*Karan Bagaria*
*MCA Final Year*
Training and Placement Representative
*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] output???

2011-08-05 Thread kartik sachan
the output will be hi

even if u have putted equal to sign there this is becoz 0.7 do not exactly
stored like 0.7 in a but some thing lesser as describe in ASCII format
that's why it is awlays lesser than 0.7

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] output???

2011-08-05 Thread Rajesh Kumar
program output comes - hi
why??

#include
main()
{
float a=0.7;
if(.7> a)
printf("hi\n");
else
printf("hello\n");
}

-- 
Regards
Rajesh Kumar

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] Output Help.

2011-07-30 Thread gaurav gupta
thanx kamakshi

On Sun, Jul 31, 2011 at 1:56 AM, Kamakshii Aggarwal
wrote:

> @gaurav:refer the link below
> http://c-faq.com/expr/seqpoints.html
>
>
> On Sun, Jul 31, 2011 at 1:53 AM, gaurav gupta wrote:
>
>> bt y it sud b undefind?
>>
>>
>> On Sun, Jul 31, 2011 at 1:51 AM, Sanchit Manchanda 
>> wrote:
>>
>>> I dint get any error, not even warning. it might depend from compiler to
>>> compiler. but yeah it should be undefined.
>>>
>>>
>>> On Sun, Jul 31, 2011 at 1:49 AM, Kamakshii Aggarwal <
>>> kamakshi...@gmail.com> wrote:
>>>
 @sanchit:it is undefined..


 On Sun, Jul 31, 2011 at 1:47 AM, Sanchit Manchanda <
 sanchit...@gmail.com> wrote:

> I am getting b=2.
> Maybe coz we are assigning 2 to b then incrementing b. But still acc to
> me it should be 3.
> :-\
> No warnings in dev cpp.
>
>
>
> On Sun, Jul 31, 2011 at 1:43 AM, Amol Sharma 
> wrote:
>
>> yup it is undefined and the warning is justified
>> b=b++ will assign 2 to b then increment b hence 3 is printed
>>
>> --
>>
>>
>> Amol Sharma
>> Third Year Student
>> Computer Science and Engineering
>> MNNIT Allahabad
>>
>>
>>
>>
>> On Sun, Jul 31, 2011 at 1:41 AM, Neeraj Gupta <
>> neeraj.gupta...@gmail.com> wrote:
>>
>>> Yes, it's UB.
>>> For such ques, try to run it on ideone.
>>> It will give a warning if any operation is not standard.
>>> http://ideone.com/bJBGl
>>>
>>>  
>>>
>>> On Sun, Jul 31, 2011 at 1:38 AM, aditi garg <
>>> aditi.garg.6...@gmail.com> wrote:
>>>
 it would be undefined...

 On Sun, Jul 31, 2011 at 1:34 AM, Kamakshii Aggarwal <
 kamakshi...@gmail.com> wrote:

> 3.it is same as b=b+1;
>
>
> On Sun, Jul 31, 2011 at 1:32 AM, aseem garg 
> wrote:
>
>> int b=2;b=b++;
>> b=???
>>
>> Plz explain..
>> Aseem
>>
>>  --
>> You received this message because you are subscribed to the Google
>> Groups "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from 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.
>



 --
 Aditi Garg
 Undergraduate Student
 Electronics & Communication Divison
 NETAJI SUBHAS INSTITUTE OF TECHNOLOGY
 Sector 3, Dwarka
 New 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.
>>>
>>
>>  --
>> You received this message because you are subscribed to the Google
>> Groups "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> Sanchit Manchanda
> COE(3rd year) , NSIT
> http://iblogmythots.wordpress.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
> htt

Re: [algogeeks] Output Help.

2011-07-30 Thread Kamakshii Aggarwal
@gaurav:refer the link below
http://c-faq.com/expr/seqpoints.html

On Sun, Jul 31, 2011 at 1:53 AM, gaurav gupta  wrote:

> bt y it sud b undefind?
>
>
> On Sun, Jul 31, 2011 at 1:51 AM, Sanchit Manchanda 
> wrote:
>
>> I dint get any error, not even warning. it might depend from compiler to
>> compiler. but yeah it should be undefined.
>>
>>
>> On Sun, Jul 31, 2011 at 1:49 AM, Kamakshii Aggarwal <
>> kamakshi...@gmail.com> wrote:
>>
>>> @sanchit:it is undefined..
>>>
>>>
>>> On Sun, Jul 31, 2011 at 1:47 AM, Sanchit Manchanda >> > wrote:
>>>
 I am getting b=2.
 Maybe coz we are assigning 2 to b then incrementing b. But still acc to
 me it should be 3.
 :-\
 No warnings in dev cpp.



 On Sun, Jul 31, 2011 at 1:43 AM, Amol Sharma wrote:

> yup it is undefined and the warning is justified
> b=b++ will assign 2 to b then increment b hence 3 is printed
>
> --
>
>
> Amol Sharma
> Third Year Student
> Computer Science and Engineering
> MNNIT Allahabad
>
>
>
>
> On Sun, Jul 31, 2011 at 1:41 AM, Neeraj Gupta <
> neeraj.gupta...@gmail.com> wrote:
>
>> Yes, it's UB.
>> For such ques, try to run it on ideone.
>> It will give a warning if any operation is not standard.
>> http://ideone.com/bJBGl
>>
>>  
>>
>> On Sun, Jul 31, 2011 at 1:38 AM, aditi garg <
>> aditi.garg.6...@gmail.com> wrote:
>>
>>> it would be undefined...
>>>
>>> On Sun, Jul 31, 2011 at 1:34 AM, Kamakshii Aggarwal <
>>> kamakshi...@gmail.com> wrote:
>>>
 3.it is same as b=b+1;


 On Sun, Jul 31, 2011 at 1:32 AM, aseem garg wrote:

> int b=2;b=b++;
> b=???
>
> Plz explain..
> Aseem
>
>  --
> You received this message because you are subscribed to the Google
> Groups "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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.

>>>
>>>
>>>
>>> --
>>> Aditi Garg
>>> Undergraduate Student
>>> Electronics & Communication Divison
>>> NETAJI SUBHAS INSTITUTE OF TECHNOLOGY
>>> Sector 3, Dwarka
>>> New 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.
>>
>
>  --
> You received this message because you are subscribed to the Google
> Groups "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



 --
 Sanchit Manchanda
 COE(3rd year) , NSIT
 http://iblogmythots.wordpress.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.

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

Re: [algogeeks] Output Help.

2011-07-30 Thread gaurav gupta
bt y it sud b undefind?

On Sun, Jul 31, 2011 at 1:51 AM, Sanchit Manchanda wrote:

> I dint get any error, not even warning. it might depend from compiler to
> compiler. but yeah it should be undefined.
>
>
> On Sun, Jul 31, 2011 at 1:49 AM, Kamakshii Aggarwal  > wrote:
>
>> @sanchit:it is undefined..
>>
>>
>> On Sun, Jul 31, 2011 at 1:47 AM, Sanchit Manchanda 
>> wrote:
>>
>>> I am getting b=2.
>>> Maybe coz we are assigning 2 to b then incrementing b. But still acc to
>>> me it should be 3.
>>> :-\
>>> No warnings in dev cpp.
>>>
>>>
>>>
>>> On Sun, Jul 31, 2011 at 1:43 AM, Amol Sharma wrote:
>>>
 yup it is undefined and the warning is justified
 b=b++ will assign 2 to b then increment b hence 3 is printed

 --


 Amol Sharma
 Third Year Student
 Computer Science and Engineering
 MNNIT Allahabad




 On Sun, Jul 31, 2011 at 1:41 AM, Neeraj Gupta <
 neeraj.gupta...@gmail.com> wrote:

> Yes, it's UB.
> For such ques, try to run it on ideone.
> It will give a warning if any operation is not standard.
> http://ideone.com/bJBGl
>
>  
>
> On Sun, Jul 31, 2011 at 1:38 AM, aditi garg  > wrote:
>
>> it would be undefined...
>>
>> On Sun, Jul 31, 2011 at 1:34 AM, Kamakshii Aggarwal <
>> kamakshi...@gmail.com> wrote:
>>
>>> 3.it is same as b=b+1;
>>>
>>>
>>> On Sun, Jul 31, 2011 at 1:32 AM, aseem garg wrote:
>>>
 int b=2;b=b++;
 b=???

 Plz explain..
 Aseem

  --
 You received this message because you are subscribed to the Google
 Groups "Algorithm Geeks" group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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.
>>>
>>
>>
>>
>> --
>> Aditi Garg
>> Undergraduate Student
>> Electronics & Communication Divison
>> NETAJI SUBHAS INSTITUTE OF TECHNOLOGY
>> Sector 3, Dwarka
>> New 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.
>

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

>>>
>>>
>>>
>>> --
>>> Sanchit Manchanda
>>> COE(3rd year) , NSIT
>>> http://iblogmythots.wordpress.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.
>>>
>>
>>
>>
>> --
>> 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.
>>
>
>
>
> --
> Sanchit Manchanda
> COE(3rd year) , NSIT
> http://iblogmythots.wordpress.com/
>
>  --
> You received this message becaus

Re: [algogeeks] Output Help.

2011-07-30 Thread Sanchit Manchanda
I dint get any error, not even warning. it might depend from compiler to
compiler. but yeah it should be undefined.

On Sun, Jul 31, 2011 at 1:49 AM, Kamakshii Aggarwal
wrote:

> @sanchit:it is undefined..
>
>
> On Sun, Jul 31, 2011 at 1:47 AM, Sanchit Manchanda 
> wrote:
>
>> I am getting b=2.
>> Maybe coz we are assigning 2 to b then incrementing b. But still acc to me
>> it should be 3.
>> :-\
>> No warnings in dev cpp.
>>
>>
>>
>> On Sun, Jul 31, 2011 at 1:43 AM, Amol Sharma wrote:
>>
>>> yup it is undefined and the warning is justified
>>> b=b++ will assign 2 to b then increment b hence 3 is printed
>>>
>>> --
>>>
>>>
>>> Amol Sharma
>>> Third Year Student
>>> Computer Science and Engineering
>>> MNNIT Allahabad
>>>
>>>
>>>
>>>
>>> On Sun, Jul 31, 2011 at 1:41 AM, Neeraj Gupta >> > wrote:
>>>
 Yes, it's UB.
 For such ques, try to run it on ideone.
 It will give a warning if any operation is not standard.
 http://ideone.com/bJBGl

  

 On Sun, Jul 31, 2011 at 1:38 AM, aditi garg 
 wrote:

> it would be undefined...
>
> On Sun, Jul 31, 2011 at 1:34 AM, Kamakshii Aggarwal <
> kamakshi...@gmail.com> wrote:
>
>> 3.it is same as b=b+1;
>>
>>
>> On Sun, Jul 31, 2011 at 1:32 AM, aseem garg wrote:
>>
>>> int b=2;b=b++;
>>> b=???
>>>
>>> Plz explain..
>>> Aseem
>>>
>>>  --
>>> You received this message because you are subscribed to the Google
>>> Groups "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from 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.
>>
>
>
>
> --
> Aditi Garg
> Undergraduate Student
> Electronics & Communication Divison
> NETAJI SUBHAS INSTITUTE OF TECHNOLOGY
> Sector 3, Dwarka
> New 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.

>>>
>>>  --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>
>>
>> --
>> Sanchit Manchanda
>> COE(3rd year) , NSIT
>> http://iblogmythots.wordpress.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.
>>
>
>
>
> --
> 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.
>



-- 
Sanchit Manchanda
COE(3rd year) , NSIT
http://iblogmythots.wordpress.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?

Re: [algogeeks] Output Help.

2011-07-30 Thread Kamakshii Aggarwal
@sanchit:it is undefined..

On Sun, Jul 31, 2011 at 1:47 AM, Sanchit Manchanda wrote:

> I am getting b=2.
> Maybe coz we are assigning 2 to b then incrementing b. But still acc to me
> it should be 3.
> :-\
> No warnings in dev cpp.
>
>
>
> On Sun, Jul 31, 2011 at 1:43 AM, Amol Sharma wrote:
>
>> yup it is undefined and the warning is justified
>> b=b++ will assign 2 to b then increment b hence 3 is printed
>>
>> --
>>
>>
>> Amol Sharma
>> Third Year Student
>> Computer Science and Engineering
>> MNNIT Allahabad
>>
>>
>>
>>
>> On Sun, Jul 31, 2011 at 1:41 AM, Neeraj Gupta 
>> wrote:
>>
>>> Yes, it's UB.
>>> For such ques, try to run it on ideone.
>>> It will give a warning if any operation is not standard.
>>> http://ideone.com/bJBGl
>>>
>>>  
>>>
>>> On Sun, Jul 31, 2011 at 1:38 AM, aditi garg 
>>> wrote:
>>>
 it would be undefined...

 On Sun, Jul 31, 2011 at 1:34 AM, Kamakshii Aggarwal <
 kamakshi...@gmail.com> wrote:

> 3.it is same as b=b+1;
>
>
> On Sun, Jul 31, 2011 at 1:32 AM, aseem garg wrote:
>
>> int b=2;b=b++;
>> b=???
>>
>> Plz explain..
>> Aseem
>>
>>  --
>> You received this message because you are subscribed to the Google
>> Groups "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from 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.
>



 --
 Aditi Garg
 Undergraduate Student
 Electronics & Communication Divison
 NETAJI SUBHAS INSTITUTE OF TECHNOLOGY
 Sector 3, Dwarka
 New 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.
>>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> Sanchit Manchanda
> COE(3rd year) , NSIT
> http://iblogmythots.wordpress.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.
>



-- 
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] Output Help.

2011-07-30 Thread Sanchit Manchanda
I am getting b=2.
Maybe coz we are assigning 2 to b then incrementing b. But still acc to me
it should be 3.
:-\
No warnings in dev cpp.


On Sun, Jul 31, 2011 at 1:43 AM, Amol Sharma  wrote:

> yup it is undefined and the warning is justified
> b=b++ will assign 2 to b then increment b hence 3 is printed
>
> --
>
>
> Amol Sharma
> Third Year Student
> Computer Science and Engineering
> MNNIT Allahabad
>
>
>
>
> On Sun, Jul 31, 2011 at 1:41 AM, Neeraj Gupta 
> wrote:
>
>> Yes, it's UB.
>> For such ques, try to run it on ideone.
>> It will give a warning if any operation is not standard.
>> http://ideone.com/bJBGl
>>
>>  
>>
>> On Sun, Jul 31, 2011 at 1:38 AM, aditi garg wrote:
>>
>>> it would be undefined...
>>>
>>> On Sun, Jul 31, 2011 at 1:34 AM, Kamakshii Aggarwal <
>>> kamakshi...@gmail.com> wrote:
>>>
 3.it is same as b=b+1;


 On Sun, Jul 31, 2011 at 1:32 AM, aseem garg wrote:

> int b=2;b=b++;
> b=???
>
> Plz explain..
> Aseem
>
>  --
> You received this message because you are subscribed to the Google
> Groups "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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.

>>>
>>>
>>>
>>> --
>>> Aditi Garg
>>> Undergraduate Student
>>> Electronics & Communication Divison
>>> NETAJI SUBHAS INSTITUTE OF TECHNOLOGY
>>> Sector 3, Dwarka
>>> New 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.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Sanchit Manchanda
COE(3rd year) , NSIT
http://iblogmythots.wordpress.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] Output Help.

2011-07-30 Thread Amol Sharma
yup it is undefined and the warning is justified
b=b++ will assign 2 to b then increment b hence 3 is printed
--


Amol Sharma
Third Year Student
Computer Science and Engineering
MNNIT Allahabad




On Sun, Jul 31, 2011 at 1:41 AM, Neeraj Gupta wrote:

> Yes, it's UB.
> For such ques, try to run it on ideone.
> It will give a warning if any operation is not standard.
> http://ideone.com/bJBGl
>
>  
>
> On Sun, Jul 31, 2011 at 1:38 AM, aditi garg wrote:
>
>> it would be undefined...
>>
>> On Sun, Jul 31, 2011 at 1:34 AM, Kamakshii Aggarwal <
>> kamakshi...@gmail.com> wrote:
>>
>>> 3.it is same as b=b+1;
>>>
>>>
>>> On Sun, Jul 31, 2011 at 1:32 AM, aseem garg  wrote:
>>>
 int b=2;b=b++;
 b=???

 Plz explain..
 Aseem

  --
 You received this message because you are subscribed to the Google
 Groups "Algorithm Geeks" group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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.
>>>
>>
>>
>>
>> --
>> Aditi Garg
>> Undergraduate Student
>> Electronics & Communication Divison
>> NETAJI SUBHAS INSTITUTE OF TECHNOLOGY
>> Sector 3, Dwarka
>> New 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.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] Output Help.

2011-07-30 Thread aseem garg
On Dev CPP.
Aseem



On Sun, Jul 31, 2011 at 1:42 AM, aseem garg  wrote:

> I am getting 2. >.<
> Aseem
>
>
>
> On Sun, Jul 31, 2011 at 1:41 AM, Neeraj Gupta 
> wrote:
>
>> Yes, it's UB.
>> For such ques, try to run it on ideone.
>> It will give a warning if any operation is not standard.
>> http://ideone.com/bJBGl
>>
>>  
>>
>> On Sun, Jul 31, 2011 at 1:38 AM, aditi garg wrote:
>>
>>> it would be undefined...
>>>
>>> On Sun, Jul 31, 2011 at 1:34 AM, Kamakshii Aggarwal <
>>> kamakshi...@gmail.com> wrote:
>>>
 3.it is same as b=b+1;


 On Sun, Jul 31, 2011 at 1:32 AM, aseem garg wrote:

> int b=2;b=b++;
> b=???
>
> Plz explain..
> Aseem
>
>  --
> You received this message because you are subscribed to the Google
> Groups "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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.

>>>
>>>
>>>
>>> --
>>> Aditi Garg
>>> Undergraduate Student
>>> Electronics & Communication Divison
>>> NETAJI SUBHAS INSTITUTE OF TECHNOLOGY
>>> Sector 3, Dwarka
>>> New 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.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] Output Help.

2011-07-30 Thread aseem garg
I am getting 2. >.<
Aseem



On Sun, Jul 31, 2011 at 1:41 AM, Neeraj Gupta wrote:

> Yes, it's UB.
> For such ques, try to run it on ideone.
> It will give a warning if any operation is not standard.
> http://ideone.com/bJBGl
>
>  
>
> On Sun, Jul 31, 2011 at 1:38 AM, aditi garg wrote:
>
>> it would be undefined...
>>
>> On Sun, Jul 31, 2011 at 1:34 AM, Kamakshii Aggarwal <
>> kamakshi...@gmail.com> wrote:
>>
>>> 3.it is same as b=b+1;
>>>
>>>
>>> On Sun, Jul 31, 2011 at 1:32 AM, aseem garg  wrote:
>>>
 int b=2;b=b++;
 b=???

 Plz explain..
 Aseem

  --
 You received this message because you are subscribed to the Google
 Groups "Algorithm Geeks" group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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.
>>>
>>
>>
>>
>> --
>> Aditi Garg
>> Undergraduate Student
>> Electronics & Communication Divison
>> NETAJI SUBHAS INSTITUTE OF TECHNOLOGY
>> Sector 3, Dwarka
>> New 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.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] Output Help.

2011-07-30 Thread Neeraj Gupta
Yes, it's UB.
For such ques, try to run it on ideone.
It will give a warning if any operation is not standard.
http://ideone.com/bJBGl

 

On Sun, Jul 31, 2011 at 1:38 AM, aditi garg wrote:

> it would be undefined...
>
> On Sun, Jul 31, 2011 at 1:34 AM, Kamakshii Aggarwal  > wrote:
>
>> 3.it is same as b=b+1;
>>
>>
>> On Sun, Jul 31, 2011 at 1:32 AM, aseem garg  wrote:
>>
>>> int b=2;b=b++;
>>> b=???
>>>
>>> Plz explain..
>>> Aseem
>>>
>>>  --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from 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.
>>
>
>
>
> --
> Aditi Garg
> Undergraduate Student
> Electronics & Communication Divison
> NETAJI SUBHAS INSTITUTE OF TECHNOLOGY
> Sector 3, Dwarka
> New 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] Output Help.

2011-07-30 Thread vidushi
@aseem its 3
different on yours ?

On Sun, Jul 31, 2011 at 1:37 AM, aseem garg  wrote:

> @Kamakshi: Run karke dekh leti pehle.  :-/
> Aseem
>
>
>
> On Sun, Jul 31, 2011 at 1:34 AM, Kamakshii Aggarwal  > wrote:
>
>> 3.it is same as b=b+1;
>>
>> On Sun, Jul 31, 2011 at 1:32 AM, aseem garg  wrote:
>>
>>> int b=2;b=b++;
>>> b=???
>>>
>>> Plz explain..
>>> Aseem
>>>
>>>  --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from 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.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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] Output Help.

2011-07-30 Thread Amol Sharma
@aseem output is 3 only...check it once again

http://ideone.com/mWGc5

--


Amol Sharma
Third Year Student
Computer Science and Engineering
MNNIT Allahabad




On Sun, Jul 31, 2011 at 1:37 AM, aseem garg  wrote:

> @Kamakshi: Run karke dekh leti pehle.  :-/
> Aseem
>
>
>
> On Sun, Jul 31, 2011 at 1:34 AM, Kamakshii Aggarwal  > wrote:
>
>> 3.it is same as b=b+1;
>>
>> On Sun, Jul 31, 2011 at 1:32 AM, aseem garg  wrote:
>>
>>> int b=2;b=b++;
>>> b=???
>>>
>>> Plz explain..
>>> Aseem
>>>
>>>  --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from 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.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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] Output Help.

2011-07-30 Thread vaibhav shukla
concept of sequence points.search wiki

On Sun, Jul 31, 2011 at 1:38 AM, aditi garg wrote:

> it would be undefined...
>
> On Sun, Jul 31, 2011 at 1:34 AM, Kamakshii Aggarwal  > wrote:
>
>> 3.it is same as b=b+1;
>>
>>
>> On Sun, Jul 31, 2011 at 1:32 AM, aseem garg  wrote:
>>
>>> int b=2;b=b++;
>>> b=???
>>>
>>> Plz explain..
>>> Aseem
>>>
>>>  --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from 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.
>>
>
>
>
> --
> Aditi Garg
> Undergraduate Student
> Electronics & Communication Divison
> NETAJI SUBHAS INSTITUTE OF TECHNOLOGY
> Sector 3, Dwarka
> New 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.
>



-- 
  best wishes!!
Vaibhav
  MCA

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] Output Help.

2011-07-30 Thread aseem garg
@Aditi: Run karke dekh leti pehle.  :-/
Aseem



On Sun, Jul 31, 2011 at 1:38 AM, aditi garg wrote:

> it would be undefined...
>
> On Sun, Jul 31, 2011 at 1:34 AM, Kamakshii Aggarwal  > wrote:
>
>> 3.it is same as b=b+1;
>>
>>
>> On Sun, Jul 31, 2011 at 1:32 AM, aseem garg  wrote:
>>
>>> int b=2;b=b++;
>>> b=???
>>>
>>> Plz explain..
>>> Aseem
>>>
>>>  --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from 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.
>>
>
>
>
> --
> Aditi Garg
> Undergraduate Student
> Electronics & Communication Divison
> NETAJI SUBHAS INSTITUTE OF TECHNOLOGY
> Sector 3, Dwarka
> New 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] Output Help.

2011-07-30 Thread Kamakshii Aggarwal
oh sorry,mane galat pad lia..mane sirf b++ dekha...
it is compiler dependent.value of b is changing twice b/w two serial points

On Sun, Jul 31, 2011 at 1:37 AM, aseem garg  wrote:

> @Kamakshi: Run karke dekh leti pehle.  :-/
> Aseem
>
>
>
> On Sun, Jul 31, 2011 at 1:34 AM, Kamakshii Aggarwal  > wrote:
>
>> 3.it is same as b=b+1;
>>
>> On Sun, Jul 31, 2011 at 1:32 AM, aseem garg  wrote:
>>
>>> int b=2;b=b++;
>>> b=???
>>>
>>> Plz explain..
>>> Aseem
>>>
>>>  --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from 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.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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] Output Help.

2011-07-30 Thread aditi garg
it would be undefined...

On Sun, Jul 31, 2011 at 1:34 AM, Kamakshii Aggarwal
wrote:

> 3.it is same as b=b+1;
>
>
> On Sun, Jul 31, 2011 at 1:32 AM, aseem garg  wrote:
>
>> int b=2;b=b++;
>> b=???
>>
>> Plz explain..
>> Aseem
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from 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.
>



-- 
Aditi Garg
Undergraduate Student
Electronics & Communication Divison
NETAJI SUBHAS INSTITUTE OF TECHNOLOGY
Sector 3, Dwarka
New 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] Output Help.

2011-07-30 Thread aseem garg
@Kamakshi: Run karke dekh leti pehle.  :-/
Aseem



On Sun, Jul 31, 2011 at 1:34 AM, Kamakshii Aggarwal
wrote:

> 3.it is same as b=b+1;
>
> On Sun, Jul 31, 2011 at 1:32 AM, aseem garg  wrote:
>
>> int b=2;b=b++;
>> b=???
>>
>> Plz explain..
>> Aseem
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from 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.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] Output Help.

2011-07-30 Thread Kamakshii Aggarwal
3.it is same as b=b+1;

On Sun, Jul 31, 2011 at 1:32 AM, aseem garg  wrote:

> int b=2;b=b++;
> b=???
>
> Plz explain..
> Aseem
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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.



[algogeeks] Output Help.

2011-07-30 Thread aseem garg
int b=2;b=b++;
b=???

Plz explain..
Aseem

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] OUTPUT PROBLEM

2011-07-30 Thread kartik sachan
*@AMOL *sending a normal pointer to a const pointer doesn't give any warning



why this is giving??

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this 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] OUTPUT PROBLEM

2011-07-30 Thread Amol Sharma
the warning comes is as

warning: passing argument 1 of ‘foo’ from incompatible pointer type


foo expects a constant char** but it is not the case...hence warning is
displayed...

remove the const keyword.you'll see no warning !!

--


Amol Sharma
Third Year Student
Computer Science and Engineering
MNNIT Allahabad




On Sat, Jul 30, 2011 at 5:30 PM, kartik sachan wrote:

>
> #include 
>   void foo(const char **p) { }
>   int main(int argc, char **argv)
>   {
>   foo(argv);
>   return 0;
>   }
>
> why the above code giving me warning can body 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.



[algogeeks] OUTPUT PROBLEM

2011-07-30 Thread kartik sachan
#include 
  void foo(const char **p) { }
  int main(int argc, char **argv)
  {
  foo(argv);
  return 0;
  }

why the above code giving me warning can body 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] output

2011-07-27 Thread Kamakshii Aggarwal
@piyush:thanks...i got my mistake

On Wed, Jul 27, 2011 at 7:30 PM, Piyush Sinha wrote:

> char const *s and const char *s are both same...try using char *const s..it
> will give error then
>
>
> On Wed, Jul 27, 2011 at 7:21 PM, Kamakshii Aggarwal  > wrote:
>
>> @magesh:so acc to you the code below should give error?
>> #include
>>
>> int main(int argc,char *argv[])
>> {
>>   char const *s="";
>>  char str[]="hello";
>>  s=str;
>>  while(*s){
>>printf("%c",*s++);
>>}
>>
>>  system("pause");
>>
>>   return 0;
>> }
>>
>>
>> On Wed, Jul 27, 2011 at 7:12 PM,  wrote:
>>
>>> ** Its not a const pointer. It is pointer to constant. So only modifying
>>> the value of s will cause error. For constant to pointer the const has to be
>>> between * and the keyword
>>>
>>> Sent from BlackBerry® on Airtel
>>> --
>>> *From: * Kamakshii Aggarwal 
>>> *Sender: * algogeeks@googlegroups.com
>>> *Date: *Wed, 27 Jul 2011 19:09:20 +0530
>>> *To: *
>>> *ReplyTo: * algogeeks@googlegroups.com
>>> *Subject: *[algogeeks] output
>>>
>>> #include
>>>
>>> int main(int argc,char *argv[])
>>> {
>>>  const char *s="";
>>>  char str[]="hello";
>>>  s=str;
>>>  while(*s){
>>>printf("%c",*s++);
>>>}
>>>
>>>  system("pause");
>>>
>>>   return 0;
>>> }
>>> o/p is hello.
>>> why the above code is running normally even when constant char pointer is
>>> being incremented...??plss help...
>>> --
>>> 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.
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from 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.
>>
>
>
>
> --
> *Piyush Sinha*
> *IIIT, Allahabad*
> *+91-7483122727*
> * <https://www.facebook.com/profile.php?id=10655377926> "NEVER SAY
> NEVER"
> *
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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] output

2011-07-27 Thread mageshthegreat
Sorry between * and the variable name.
Sent from BlackBerry® on Airtel

-Original Message-
From: Kamakshii Aggarwal 
Sender: algogeeks@googlegroups.com
Date: Wed, 27 Jul 2011 19:21:13 
To: 
Reply-To: algogeeks@googlegroups.com
Subject: Re: [algogeeks] output

@magesh:so acc to you the code below should give error?
#include

int main(int argc,char *argv[])
{
  char const *s="";
 char str[]="hello";
 s=str;
 while(*s){
   printf("%c",*s++);
   }

 system("pause");

  return 0;
}


On Wed, Jul 27, 2011 at 7:12 PM,  wrote:

> ** Its not a const pointer. It is pointer to constant. So only modifying
> the value of s will cause error. For constant to pointer the const has to be
> between * and the keyword
>
> Sent from BlackBerry® on Airtel
> --
> *From: * Kamakshii Aggarwal 
> *Sender: * algogeeks@googlegroups.com
> *Date: *Wed, 27 Jul 2011 19:09:20 +0530
> *To: *
> *ReplyTo: * algogeeks@googlegroups.com
> *Subject: *[algogeeks] output
>
> #include
>
> int main(int argc,char *argv[])
> {
>  const char *s="";
>  char str[]="hello";
>  s=str;
>  while(*s){
>printf("%c",*s++);
>}
>
>  system("pause");
>
>   return 0;
> }
> o/p is hello.
> why the above code is running normally even when constant char pointer is
> being incremented...??plss help...
> --
> 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.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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.


-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] output

2011-07-27 Thread Piyush Sinha
char const *s and const char *s are both same...try using char *const s..it
will give error then

On Wed, Jul 27, 2011 at 7:21 PM, Kamakshii Aggarwal
wrote:

> @magesh:so acc to you the code below should give error?
> #include
>
> int main(int argc,char *argv[])
> {
>   char const *s="";
>  char str[]="hello";
>  s=str;
>  while(*s){
>printf("%c",*s++);
>}
>
>  system("pause");
>
>   return 0;
> }
>
>
> On Wed, Jul 27, 2011 at 7:12 PM,  wrote:
>
>> ** Its not a const pointer. It is pointer to constant. So only modifying
>> the value of s will cause error. For constant to pointer the const has to be
>> between * and the keyword
>>
>> Sent from BlackBerry® on Airtel
>> --
>> *From: * Kamakshii Aggarwal 
>> *Sender: * algogeeks@googlegroups.com
>> *Date: *Wed, 27 Jul 2011 19:09:20 +0530
>> *To: *
>> *ReplyTo: * algogeeks@googlegroups.com
>> *Subject: *[algogeeks] output
>>
>> #include
>>
>> int main(int argc,char *argv[])
>> {
>>  const char *s="";
>>  char str[]="hello";
>>  s=str;
>>  while(*s){
>>printf("%c",*s++);
>>}
>>
>>  system("pause");
>>
>>   return 0;
>> }
>> o/p is hello.
>> why the above code is running normally even when constant char pointer is
>> being incremented...??plss help...
>> --
>> 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.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from 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.
>



-- 
*Piyush Sinha*
*IIIT, Allahabad*
*+91-7483122727*
* <https://www.facebook.com/profile.php?id=10655377926> "NEVER SAY
NEVER"
*

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] output

2011-07-27 Thread Kamakshii Aggarwal
@magesh:so acc to you the code below should give error?
#include

int main(int argc,char *argv[])
{
  char const *s="";
 char str[]="hello";
 s=str;
 while(*s){
   printf("%c",*s++);
   }

 system("pause");

  return 0;
}


On Wed, Jul 27, 2011 at 7:12 PM,  wrote:

> ** Its not a const pointer. It is pointer to constant. So only modifying
> the value of s will cause error. For constant to pointer the const has to be
> between * and the keyword
>
> Sent from BlackBerry® on Airtel
> --
> *From: * Kamakshii Aggarwal 
> *Sender: * algogeeks@googlegroups.com
> *Date: *Wed, 27 Jul 2011 19:09:20 +0530
> *To: *
> *ReplyTo: * algogeeks@googlegroups.com
> *Subject: *[algogeeks] output
>
> #include
>
> int main(int argc,char *argv[])
> {
>  const char *s="";
>  char str[]="hello";
>  s=str;
>  while(*s){
>printf("%c",*s++);
>}
>
>  system("pause");
>
>   return 0;
> }
> o/p is hello.
> why the above code is running normally even when constant char pointer is
> being incremented...??plss help...
> --
> 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.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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] output

2011-07-27 Thread mageshthegreat
Its not a const pointer. It is pointer to constant. So only modifying the value 
of s will cause error. For constant to pointer the const has to be between * 
and the keyword
Sent from BlackBerry® on Airtel

-Original Message-
From: Kamakshii Aggarwal 
Sender: algogeeks@googlegroups.com
Date: Wed, 27 Jul 2011 19:09:20 
To: 
Reply-To: algogeeks@googlegroups.com
Subject: [algogeeks] output

#include

int main(int argc,char *argv[])
{
 const char *s="";
 char str[]="hello";
 s=str;
 while(*s){
   printf("%c",*s++);
   }

 system("pause");

  return 0;
}
o/p is hello.
why the above code is running normally even when constant char pointer is
being incremented...??plss help...
-- 
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.


-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] output

2011-07-27 Thread Kamakshii Aggarwal
#include

int main(int argc,char *argv[])
{
 const char *s="";
 char str[]="hello";
 s=str;
 while(*s){
   printf("%c",*s++);
   }

 system("pause");

  return 0;
}
o/p is hello.
why the above code is running normally even when constant char pointer is
being incremented...??plss help...
-- 
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] OUTPUT

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


Regards
Ramya

*Try to learn something about everything and everything about something*

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] OUTPUT

2011-07-27 Thread Kamakshii Aggarwal
#include
# define MAXROW 3
#define MAXCOL 4


int main()
{
int (*p)[MAXCOL];
p=(int(*)[MAXCOL])malloc(MAXROW*sizeof(*p));
printf("%d %d",sizeof(p),sizeof(*p));

 system("pause");

  return 0;
}

THE O/P IS 4 16.
I am not getting the reason.plss help

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] OUTPUT

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

On 7/26/11, kavitha nk  wrote:
> ans ll nt be 0 0 2 va???
>
> On 7/25/11, Puneet Gautam  wrote:
>> @aditi: the "%2" in each of these printf statements is redundant coz
>> it is "1%2"...and "%" has higher precedence over left or right
>> shifts..thats y output of say :
>>
>> #include
>> main()
>> {
>> int i=1;
>> printf("\n%d%d ",i<<=2,i<<=1%2);
>> return 0;
>> }
>>
>> is 8 8
>>
>> 1 gets left shifted twice in i<<=2, becomes 4
>> then i<<1%2 concludes to i<<1 as 1%2 is 1 only..
>> i<<1 ,makes i=8 and hence
>>
>> 8 8 is printed.
>>
>> On 7/25/11, Puneet Gautam  wrote:
>>> @rajeev: hey...does printf evaluate an expression right to left
>>> without considering any priority of operators..?
>>> Pls reply asap..
>>>
>>>
>>>
>>> On 7/25/11, Puneet Gautam  wrote:
 @aditi: y dont u try it out urself considering the priorities of
 different operators used here...!!
 that would help...

 On 7/25/11, aditi garg  wrote:
> Can u plz elaborate...im not able to understand...
>
> On Mon, Jul 25, 2011 at 11:04 PM, rajeev bharshetty
> wrote:
>
>> @sameer I think that is right
>>
>>
>> On Mon, Jul 25, 2011 at 11:02 PM, sameer.mut...@gmail.com <
>> sameer.mut...@gmail.com> wrote:
>>
>>> its because of side effect where value of i is getting changed twice
>>> in
>>> a
>>> single line.
>>> correct me if i am wrong :)
>>>
>>> *Muthuraj R.
>>> 4TH Year BE.**
>>> Information Science Dept*
>>> *PESIT, Bengaluru .
>>> *
>>>
>>>
>>>
>>>
>>> On Mon, Jul 25, 2011 at 11:01 PM, geek forgeek
>>> wrote:
>>>
 y not the output is 3 2  coz on right to left evaluation  of printf
 i
 shud be left shifted by 1 bit wgich shud make it 2 ??


 On Mon, Jul 25, 2011 at 10:28 AM, sameer.mut...@gmail.com <
 sameer.mut...@gmail.com> wrote:

> yeah output
>  0
> 1 1
> *is dis because of side effect? *
> * *
> *
> *
> *Muthuraj R.
> 4TH Year BE.**
> Information Science Dept*
> *PESIT, Bengaluru .
> *
>
>
>
>
>
> On Mon, Jul 25, 2011 at 10:49 PM, Deoki Nandan
> wrote:
>
>> run on gcc compiler it would be
>> 0
>> 1 1
>>
>>
>> On Mon, Jul 25, 2011 at 10:35 PM, geek forgeek
>> wrote:
>>
>>> 1.
>>> #include
>>> main()
>>> {
>>> int i=1;
>>>  printf("\n%d",i^=1%2);
>>>  printf("\n%d %d",i^=1%2,i<<=1%2);
>>> return 0;
>>> }
>>>
>>> output 3 3
>>> hey shudnt the output be 3 2
>>>
>>>
>>>  --
>>> You received this message because you are subscribed to the
>>> Google
>>> Groups "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from 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
>> Deoki Nandan Vishwakarma
>>
>> *
>> *
>>
>>  --
>> You received this message because you are subscribed to the
>> Google
>> Groups "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from 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
>>

  1   2   3   >