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,

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

[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, ou

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 proced

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

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.

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 Goo

[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

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

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

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 pos

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

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

[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); bre

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

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

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 con

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

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)

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

[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

[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, se

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

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

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); > p

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

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); > } >

[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

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 >

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 n

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

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 wu

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() >> { >> cha

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

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,

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

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

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

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

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 subscri

[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@g

Re: [algogeeks] output help

2011-08-09 Thread SANDEEP CHUGH
i dnt get it.. any better explanation.. On Tue, Aug 9, 2011 at 1:13 PM, dinesh bansal wrote: > On a little-endian machine, bit structure will be represented as: > > 0x00 00 00 45 > > which is bit.bit4 = 0010 (2 in decimal) bit.bit3 = 0010 (2 in decimal) > bit.bit1 = 1 (1 in decimal) > > since b

Re: [algogeeks] output help

2011-08-09 Thread dinesh bansal
On a little-endian machine, bit structure will be represented as: 0x00 00 00 45 which is bit.bit4 = 0010 (2 in decimal) bit.bit3 = 0010 (2 in decimal) bit.bit1 = 1 (1 in decimal) since bit.bit1 exists at the rightmost position, while displaying data as integer, compiler just repeats the same bi

Re: [algogeeks] output help

2011-08-09 Thread Rohit Srivastava
hey guys thanks got it!! On Tue, Aug 9, 2011 at 12:49 PM, sanjay ahuja wrote: > Int bit3:4 will be read as lower order 4 bits of bit3 and this will be > treated as int (signed). Thus lower order bit of bit3 which is 2, are > 0010 which is 2 > try with > 1) int bit3:2, output will be -2 > 2)

Re: [algogeeks] output help

2011-08-09 Thread sanjay ahuja
Int bit3:4 will be read as lower order 4 bits of bit3 and this will be treated as int (signed). Thus lower order bit of bit3 which is 2, are 0010 which is 2 try with 1) int bit3:2, output will be -2 2) unsigned int bit3:2, output will be 2. I hope it is cleared now On 8/9/11, Rohit Srivastava wr

Re: [algogeeks] output help

2011-08-09 Thread aditi garg
I think it is because bit1 is only 1 bit fwide and whn u initialize it to 1,since MSB is 1 it treats it as a negative integer...Plz correct me if i am wrong... On Tue, Aug 9, 2011 at 12:24 PM, Rohit Srivastava wrote: > #include > #include > > int main() > { > struct value > { > in

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

Re: [algogeeks] output help

2011-08-07 Thread Kamakshii Aggarwal
got it...thanks On Mon, Aug 8, 2011 at 12:39 AM, aseem garg wrote: > typedef doesn't declare an instance of a variable, it declares a type (type > alias actually), > > static is a qualifier you apply to an instance, not a type, so you can use > static when you use the type, but not when you defi

Re: [algogeeks] output help

2011-08-07 Thread aseem garg
typedef doesn't declare an instance of a variable, it declares a type (type alias actually), static is a qualifier you apply to an instance, not a type, so you can use static when you use the type, but not when you define the type. Aseem On Mon, Aug 8, 2011 at 12:29 AM, Kamakshii Aggarwal wrote

Re: [algogeeks] output help

2011-08-07 Thread Amol Sharma
using typedef u define the static keyword as int and the statement static int j thus becomes int int j hence the compiler gives the error "multiple storage class in declaration specifiers" -- Amol Sharma Third Year Student Computer Science and Engineering MNNIT Allahabad On Mon, Aug 8, 2011

[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" gr

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

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

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

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

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

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

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

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

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

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

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

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.

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 ASC

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

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

[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@googl

Re: [algogeeks] Output Help.

2011-07-30 Thread gaurav gupta
thanx kamakshi On Sun, Jul 31, 2011 at 1:56 AM, Kamakshii Aggarwal wrote: > @gaurav:refer the link below > http://c-faq.com/expr/seqpoints.html > > > On Sun, Jul 31, 2011 at 1:53 AM, gaurav gupta wrote: > >> bt y it sud b undefind? >> >> >> On Sun, Jul 31, 2011 at 1:51 AM, Sanchit Manchanda >> w

Re: [algogeeks] Output Help.

2011-07-30 Thread Kamakshii Aggarwal
@gaurav:refer the link below http://c-faq.com/expr/seqpoints.html On Sun, Jul 31, 2011 at 1:53 AM, gaurav gupta wrote: > bt y it sud b undefind? > > > On Sun, Jul 31, 2011 at 1:51 AM, Sanchit Manchanda > wrote: > >> I dint get any error, not even warning. it might depend from compiler to >> com

Re: [algogeeks] Output Help.

2011-07-30 Thread gaurav gupta
bt y it sud b undefind? On Sun, Jul 31, 2011 at 1:51 AM, Sanchit Manchanda wrote: > I dint get any error, not even warning. it might depend from compiler to > compiler. but yeah it should be undefined. > > > On Sun, Jul 31, 2011 at 1:49 AM, Kamakshii Aggarwal > wrote: > >> @sanchit:it is undefin

Re: [algogeeks] Output Help.

2011-07-30 Thread Sanchit Manchanda
I dint get any error, not even warning. it might depend from compiler to compiler. but yeah it should be undefined. On Sun, Jul 31, 2011 at 1:49 AM, Kamakshii Aggarwal wrote: > @sanchit:it is undefined.. > > > On Sun, Jul 31, 2011 at 1:47 AM, Sanchit Manchanda > wrote: > >> I am getting b=2. >>

Re: [algogeeks] Output Help.

2011-07-30 Thread Kamakshii Aggarwal
@sanchit:it is undefined.. On Sun, Jul 31, 2011 at 1:47 AM, Sanchit Manchanda wrote: > I am getting b=2. > Maybe coz we are assigning 2 to b then incrementing b. But still acc to me > it should be 3. > :-\ > No warnings in dev cpp. > > > > On Sun, Jul 31, 2011 at 1:43 AM, Amol Sharma wrote: > >>

Re: [algogeeks] Output Help.

2011-07-30 Thread Sanchit Manchanda
I am getting b=2. Maybe coz we are assigning 2 to b then incrementing b. But still acc to me it should be 3. :-\ No warnings in dev cpp. On Sun, Jul 31, 2011 at 1:43 AM, Amol Sharma wrote: > yup it is undefined and the warning is justified > b=b++ will assign 2 to b then increment b hence 3 is

Re: [algogeeks] Output Help.

2011-07-30 Thread Amol Sharma
yup it is undefined and the warning is justified b=b++ will assign 2 to b then increment b hence 3 is printed -- Amol Sharma Third Year Student Computer Science and Engineering MNNIT Allahabad On Sun, Jul 31, 2011 at 1:41 AM, Neeraj Gupta wrote: > Yes, it's UB. > For such ques, try to run it

Re: [algogeeks] Output Help.

2011-07-30 Thread aseem garg
On Dev CPP. Aseem On Sun, Jul 31, 2011 at 1:42 AM, aseem garg wrote: > I am getting 2. >.< > Aseem > > > > On Sun, Jul 31, 2011 at 1:41 AM, Neeraj Gupta > wrote: > >> Yes, it's UB. >> For such ques, try to run it on ideone. >> It will give a warning if any operation is not standard. >> http:/

Re: [algogeeks] Output Help.

2011-07-30 Thread aseem garg
I am getting 2. >.< Aseem On Sun, Jul 31, 2011 at 1:41 AM, Neeraj Gupta wrote: > Yes, it's UB. > For such ques, try to run it on ideone. > It will give a warning if any operation is not standard. > http://ideone.com/bJBGl > > > > On Sun, Jul 31, 2011 at 1:38 AM, aditi

Re: [algogeeks] Output Help.

2011-07-30 Thread Neeraj Gupta
Yes, it's UB. For such ques, try to run it on ideone. It will give a warning if any operation is not standard. http://ideone.com/bJBGl On Sun, Jul 31, 2011 at 1:38 AM, aditi garg wrote: > it would be undefined... > > On Sun, Jul 31, 2011 at 1:34 AM, Kamakshii Aggarwal

Re: [algogeeks] Output Help.

2011-07-30 Thread vidushi
@aseem its 3 different on yours ? On Sun, Jul 31, 2011 at 1:37 AM, aseem garg wrote: > @Kamakshi: Run karke dekh leti pehle. :-/ > Aseem > > > > On Sun, Jul 31, 2011 at 1:34 AM, Kamakshii Aggarwal > wrote: > >> 3.it is same as b=b+1; >> >> On Sun, Jul 31, 2011 at 1:32 AM, aseem garg wrote: >>

Re: [algogeeks] Output Help.

2011-07-30 Thread Amol Sharma
@aseem output is 3 only...check it once again http://ideone.com/mWGc5 -- Amol Sharma Third Year Student Computer Science and Engineering MNNIT Allahabad On Sun, Jul 31, 2011 at 1:37 AM, aseem garg wrote: > @Kamakshi: Run karke dekh leti pehle. :-/ > Aseem > > > > On Sun, Jul 31, 2011 at

Re: [algogeeks] Output Help.

2011-07-30 Thread vaibhav shukla
concept of sequence points.search wiki On Sun, Jul 31, 2011 at 1:38 AM, aditi garg wrote: > it would be undefined... > > On Sun, Jul 31, 2011 at 1:34 AM, Kamakshii Aggarwal > wrote: > >> 3.it is same as b=b+1; >> >> >> On Sun, Jul 31, 2011 at 1:32 AM, aseem garg wrote: >> >>> int b=2;b=b++;

Re: [algogeeks] Output Help.

2011-07-30 Thread aseem garg
@Aditi: Run karke dekh leti pehle. :-/ Aseem On Sun, Jul 31, 2011 at 1:38 AM, aditi garg wrote: > it would be undefined... > > On Sun, Jul 31, 2011 at 1:34 AM, Kamakshii Aggarwal > wrote: > >> 3.it is same as b=b+1; >> >> >> On Sun, Jul 31, 2011 at 1:32 AM, aseem garg wrote: >> >>> int b=2;b

Re: [algogeeks] Output Help.

2011-07-30 Thread Kamakshii Aggarwal
oh sorry,mane galat pad lia..mane sirf b++ dekha... it is compiler dependent.value of b is changing twice b/w two serial points On Sun, Jul 31, 2011 at 1:37 AM, aseem garg wrote: > @Kamakshi: Run karke dekh leti pehle. :-/ > Aseem > > > > On Sun, Jul 31, 2011 at 1:34 AM, Kamakshii Aggarwal > w

Re: [algogeeks] Output Help.

2011-07-30 Thread aditi garg
it would be undefined... On Sun, Jul 31, 2011 at 1:34 AM, Kamakshii Aggarwal wrote: > 3.it is same as b=b+1; > > > On Sun, Jul 31, 2011 at 1:32 AM, aseem garg wrote: > >> int b=2;b=b++; >> b=??? >> >> Plz explain.. >> Aseem >> >> -- >> You received this message because you are subscribed to the

Re: [algogeeks] Output Help.

2011-07-30 Thread aseem garg
@Kamakshi: Run karke dekh leti pehle. :-/ Aseem On Sun, Jul 31, 2011 at 1:34 AM, Kamakshii Aggarwal wrote: > 3.it is same as b=b+1; > > On Sun, Jul 31, 2011 at 1:32 AM, aseem garg wrote: > >> int b=2;b=b++; >> b=??? >> >> Plz explain.. >> Aseem >> >> -- >> You received this message because y

Re: [algogeeks] Output Help.

2011-07-30 Thread Kamakshii Aggarwal
3.it is same as b=b+1; On Sun, Jul 31, 2011 at 1:32 AM, aseem garg wrote: > int b=2;b=b++; > b=??? > > Plz explain.. > Aseem > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algogeeks@googlegroup

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

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 gro

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

Re: [algogeeks] output

2011-07-27 Thread Kamakshii Aggarwal
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

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

Re: [algogeeks] output

2011-07-27 Thread Piyush Sinha
arwal >> *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[]) >> { >

Re: [algogeeks] output

2011-07-27 Thread Kamakshii Aggarwal
> *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[]) > { >

Re: [algogeeks] output

2011-07-27 Thread mageshthegreat
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&

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

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 somet

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

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 wron

  1   2   3   >