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 pawan1991ya...@gmail.comwrote: Hi All, I'm not able to get output of following c program : #includestdio.h main() { int a[] ={

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 afroze...@gmail.com wrote: I got some other outputs.. when line 6 isn't commented i got 3 1 2 3, i m using turbo c++ compiler..

[algogeeks] output

2013-12-06 Thread pawan yadav
Hi All, I'm not able to get output of following c program : #includestdio.h 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,

[algogeeks] Output

2012-11-24 Thread rajesh pandey
void dosomething(int num) { int mask=~(15-1); int res=nummask; 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

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

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

[algogeeks] output of the program with explanation

2012-11-05 Thread rajesh pandey
*int *x ,int *y; x=(int *) 50; y=(int *)20; coutx-yendl; 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

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 rajesh.pandey.i...@gmail.com *int *x ,int *y; x=(int *) 50; y=(int *)20; coutx-yendl; why the output is 7.* -- You received this message because

[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

[algogeeks] output C

2012-02-25 Thread Ravi Ranjan
#include stdio.h #include stdlib.h #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 };

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

[algogeeks] output expalnation?

2011-09-26 Thread Ratan
#includestdio.h int main() { int a=1; switch(a) { int b=6; case 1: printf(b is %d,b); break; default: printf(b is %d:,b);

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 success.rata...@gmail.com wrote: #includestdio.h int main() { int a=1;

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,

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 gauravyadav1...@gmail.com wrote: b=6 will not execute.. -- You received this message because you are subscribed to the Google Groups Algorithm

[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

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

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 rajkumar.cs...@gmail.comwrote: main(){printf(%s,printf(samsung)+fun());}fun(){return electronic;} The printf is a function which returns the number of printed

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

[algogeeks] Output question

2011-08-22 Thread vartika
#includestdio.h #includestring.h 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

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

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

[algogeeks] Output?? Why??

2011-08-17 Thread noobcoder
#includestdio.h 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,

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 manis...@gmail.com 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;

Re: [algogeeks] output

2011-08-12 Thread Avenged
this is the question : #includestdio.h #define prn(a) printf(%d,a) #define print(a,b,c) prn(a), prn(b), prn(c) #define max(a,b) (ab?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

Re: [algogeeks] output

2011-08-12 Thread Anil Arya
Answer=: 32 On Fri, Aug 12, 2011 at 8:05 PM, Avenged nitee...@gmail.com wrote: this is the question : #includestdio.h #define prn(a) printf(%d,a) #define print(a,b,c) prn(a), prn(b), prn(c) #define max(a,b) (ab?a:b) int main() { int x=1, y=2; 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-11 Thread Anika Jain
this code has so many errors On Thu, Aug 11, 2011 at 11:36 PM, manvir siyo manis...@gmail.com 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);

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 anika.jai...@gmail.com wrote: this code has so many errors On Thu, Aug 11, 2011 at 11:36 PM, manvir siyo manis...@gmail.com wrote: output of the program? #define prn(a) printf(%d,a) #define

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 sandeep.aa...@gmail.comwrote: @all sorry i give wrong

[algogeeks] output help

2011-08-09 Thread Rohit Srivastava
#includestdio.h #includeconio.h 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

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 access2ro...@gmail.comwrote: #includestdio.h #includeconio.h int main() {

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

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 sanjayahuja.i...@gmail.comwrote: 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,

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

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 bansal...@gmail.com 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

[algogeeks] output?

2011-08-09 Thread tech rascal
#includestdio.h 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

Re: [algogeeks] output?

2011-08-09 Thread aditi garg
it doesnt matter On Tue, Aug 9, 2011 at 10:20 PM, tech rascal techrascal...@gmail.comwrote: #includestdio.h 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

Re: [algogeeks] output?

2011-08-09 Thread Jayanthi shravan
it matters.. On Tue, Aug 9, 2011 at 10:20 PM, tech rascal techrascal...@gmail.comwrote: 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

Re: [algogeeks] output?

2011-08-09 Thread tech rascal
explanation?? On Tue, Aug 9, 2011 at 10:24 PM, aditi garg aditi.garg.6...@gmail.comwrote: it doesnt matter On Tue, Aug 9, 2011 at 10:20 PM, tech rascal techrascal...@gmail.comwrote: #includestdio.h int main() { char ch; if((ch=printf())) printf(it matters); else printf(it doesn't

Re: [algogeeks] output?

2011-08-09 Thread siddharth srivastava
On 9 August 2011 22:20, tech rascal techrascal...@gmail.com wrote: #includestdio.h 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

Re: [algogeeks] output?

2011-08-09 Thread Varun Jakhoria
it doesn't matter On Tue, Aug 9, 2011 at 10:24 PM, Jayanthi shravan jayanthisra...@gmail.com wrote:   it matters.. On Tue, Aug 9, 2011 at 10:20 PM, tech rascal techrascal...@gmail.com wrote: what will b the output?? -- You received this message because you are subscribed to the Google

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

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 akssps...@gmail.com wrote: On 9 August 2011 22:20, tech rascal techrascal...@gmail.com wrote:

Re: [algogeeks] output?

2011-08-09 Thread SANDEEP CHUGH
it doesn't matter On Tue, Aug 9, 2011 at 10:25 PM, siddharth srivastava akssps...@gmail.comwrote: On 9 August 2011 22:20, tech rascal techrascal...@gmail.com wrote: #includestdio.h 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 siddharth srivastava
my bad..that I didn't notice = (assumed it to be ==) On 9 August 2011 22:28, SANDEEP CHUGH sandeep.aa...@gmail.com wrote: it doesn't matter On Tue, Aug 9, 2011 at 10:25 PM, siddharth srivastava akssps...@gmail.com wrote: On 9 August 2011 22:20, tech rascal techrascal...@gmail.com wrote:

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

[algogeeks] output help

2011-08-07 Thread Kamakshii Aggarwal
#includestdio.h 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

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

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

Re: [algogeeks] output help

2011-08-07 Thread Kamakshii Aggarwal
got it...thanks On Mon, Aug 8, 2011 at 12:39 AM, aseem garg ase.as...@gmail.com 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

[algogeeks] OUTPUT????

2011-08-06 Thread SHIVAM AGRAWAL
any1 plz tell me y output of float type of dis prgrm is zero? #includestdio.h #define INT 1 main() { struct a { int type; }; struct c { int type; int e; }; struct b {

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 shivi...@gmail.com wrote: any1 plz tell me y output of float type of dis prgrm is zero? #includestdio.h #define INT 1 main() { struct a

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 shivi...@gmail.com wrote: any1 plz tell me y output of float type of dis prgrm is zero? #includestdio.h #define INT 1 main() { struct a {

[algogeeks] output???

2011-08-05 Thread Rajesh Kumar
program output comes - hi why?? #includestdio.h 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

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

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 kartik.sac...@gmail.comwrote: 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

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 kamakshi...@gmail.comwrote: the reason is dat 0.7

Re: [algogeeks] output???

2011-08-05 Thread Rajesh Kumar
Thanks to all On Fri, Aug 5, 2011 at 8:53 PM, sukran dhawan sukrandha...@gmail.comwrote: 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,

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,

[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

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 ranjane...@gmail.com 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

Re: [algogeeks] output

2011-08-05 Thread saurabh singh
Try compiling with gcc -E filename.c.That will clear everything On Sat, Aug 6, 2011 at 10:25 AM, saurabh singh saurab...@gmail.com wrote: hint:MACRo is just substituted as it is On Sat, Aug 6, 2011 at 10:23 AM, ranjane ranjane...@gmail.com wrote: # define swap(a,b) temp=a; a=b;

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 saurab...@gmail.com wrote: Try compiling with gcc -E filename.c.That will clear everything On Sat, Aug 6, 2011 at 10:25 AM, saurabh singh saurab...@gmail.com wrote: hint:MACRo is just substituted as it is On

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;

[algogeeks] OUTPUT PROBLEM

2011-07-30 Thread kartik sachan
#include stdio.h 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

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

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

[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 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 ase.as...@gmail.com 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

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 kamakshi...@gmail.comwrote: 3.it is same as b=b+1; On Sun, Jul 31, 2011 at 1:32 AM, aseem garg ase.as...@gmail.com wrote: int b=2;b=b++; b=??? Plz explain.. Aseem -- You received

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 kamakshi...@gmail.comwrote: 3.it is same as b=b+1; On Sun, Jul 31, 2011 at 1:32 AM, aseem garg ase.as...@gmail.com wrote: int b=2;b=b++; b=??? Plz explain.. Aseem -- You received this message because you

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 ase.as...@gmail.com wrote: @Kamakshi: Run karke dekh leti pehle. :-/ Aseem On Sun, Jul 31, 2011 at 1:34 AM, Kamakshii

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 aditi.garg.6...@gmail.comwrote: 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,

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 aditi.garg.6...@gmail.comwrote: 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

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 ase.as...@gmail.com wrote: @Kamakshi: Run karke dekh leti pehle. :-/ Aseem On Sun,

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 ase.as...@gmail.com wrote: @Kamakshi: Run karke dekh leti pehle. :-/ Aseem 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

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 http://ideone.com/bJBGl On Sun, Jul 31, 2011 at 1:38 AM, aditi garg aditi.garg.6...@gmail.comwrote: it would be undefined... On Sun, Jul 31, 2011 at 1:34

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 neeraj.gupta...@gmail.comwrote: 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 http://ideone.com/bJBGl On Sun, Jul 31, 2011 at

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 ase.as...@gmail.com wrote: I am getting 2. . Aseem On Sun, Jul 31, 2011 at 1:41 AM, Neeraj Gupta neeraj.gupta...@gmail.comwrote: Yes, it's UB. For such ques, try to run it on ideone. It will give a warning if any

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 neeraj.gupta...@gmail.comwrote: Yes, it's UB. For

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 amolsharm...@gmail.com wrote: yup it is undefined and the warning is justified b=b++ will assign 2 to b then

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 sanchit...@gmail.comwrote: 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

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 kamakshi...@gmail.comwrote: @sanchit:it is undefined.. On Sun, Jul 31, 2011 at 1:47 AM, Sanchit Manchanda

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 sanchit...@gmail.comwrote: 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

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 grvgupta...@gmail.com wrote: bt y it sud b undefind? On Sun, Jul 31, 2011 at 1:51 AM, Sanchit Manchanda sanchit...@gmail.comwrote: I dint get any error, not even warning. it

Re: [algogeeks] Output Help.

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

[algogeeks] OUTPUT

2011-07-27 Thread Kamakshii Aggarwal
#includestdio.h # 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

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

Re: [algogeeks] output

2011-07-27 Thread Kamakshii Aggarwal
...@gmail.com *Sender: * algogeeks@googlegroups.com *Date: *Wed, 27 Jul 2011 19:09:20 +0530 *To: *algogeeks@googlegroups.com *ReplyTo: * algogeeks@googlegroups.com *Subject: *[algogeeks] output #includestdio.h int main(int argc,char *argv[]) { const char *s=; char str[]=hello; s=str; while(*s

Re: [algogeeks] output

2011-07-27 Thread Kamakshii Aggarwal
kamakshi...@gmail.com *Sender: * algogeeks@googlegroups.com *Date: *Wed, 27 Jul 2011 19:09:20 +0530 *To: *algogeeks@googlegroups.com *ReplyTo: * algogeeks@googlegroups.com *Subject: *[algogeeks] output #includestdio.h int main(int argc,char *argv[]) { const char *s=; char str[]=hello; s

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

Re: [algogeeks] output please

2011-07-25 Thread Arshad Alam
yes I understand, thanks to both of you On Sun, Jul 24, 2011 at 10:10 PM, rajeev bharshetty rajeevr...@gmail.comwrote: value 200 exceeds the char range so -56 , to print 200 try unsigned char . On Sun, Jul 24, 2011 at 10:06 PM, Prashant Gupta prashantatn...@gmail.com wrote: -56 On Sun,

Re: [algogeeks] output please

2011-07-25 Thread kavitha nk
it is printed in %d format nd not as %ch... -- //BE COOL// kavi -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to

[algogeeks] OUTPUT

2011-07-25 Thread geek forgeek
1. #includestdio.h 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

Re: [algogeeks] OUTPUT

2011-07-25 Thread Deoki Nandan
run on gcc compiler it would be 0 1 1 On Mon, Jul 25, 2011 at 10:35 PM, geek forgeek geekhori...@gmail.comwrote: 1. #includestdio.h 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

Re: [algogeeks] OUTPUT

2011-07-25 Thread aditi garg
@ Deoki : Can u please explain how did dis outcome come? On Mon, Jul 25, 2011 at 10:49 PM, Deoki Nandan deok...@gmail.com wrote: run on gcc compiler it would be 0 1 1 On Mon, Jul 25, 2011 at 10:35 PM, geek forgeek geekhori...@gmail.comwrote: 1. #includestdio.h main() { int i=1;

Re: [algogeeks] OUTPUT

2011-07-25 Thread rajeev bharshetty
@Deoki Remove the first printf from the program .. You will get 3 3 . The first printf should be removed . And about the output as 3 3 it is beacuse of the right to left eval of printf so i has value 3 after evaluation. On Mon, Jul 25, 2011 at 10:49 PM, Deoki Nandan deok...@gmail.com wrote: run

Re: [algogeeks] OUTPUT

2011-07-25 Thread geek forgeek
ma mistake code is #includestdio.h main() { int i=1; printf(\n%d %d,i^=1%2,i=1%2); return 0; } On Mon, Jul 25, 2011 at 10:19 AM, Deoki Nandan deok...@gmail.com wrote: run on gcc compiler it would be 0 1 1 On Mon, Jul 25, 2011 at 10:35 PM, geek forgeek geekhori...@gmail.comwrote: 1.

Re: [algogeeks] OUTPUT

2011-07-25 Thread sameer.mut...@gmail.com
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 deok...@gmail.com wrote: run on gcc compiler it would be 0 1 1 On Mon, Jul 25, 2011 at 10:35 PM, geek

  1   2   3   >