Re: [algogeeks] C Problem

2011-09-19 Thread kartik sachan
+1 to yogesh -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this

Re: [algogeeks] C Problem

2011-09-17 Thread sukran dhawan
4 and 5. size of will check its first operand. so no evaluation takes place... On Sat, Sep 17, 2011 at 2:32 PM, abhinav gupta wrote: > Ans will be:4,5 > > > On Sat, Sep 17, 2011 at 2:23 PM, Sanjay Rajpal wrote: > >> #include >> >> int main() >> { >> int a=5; >> printf("Size : %d\n",sizeof( a

Re: [algogeeks] C Problem

2011-09-17 Thread Yogesh Yadav
4,5 statements inside sizeof() does not get executed...it will tell just size... int a=3; printf("%d",sizeof(a++)); here a++ will not be executed ...it will just tell size ... Also, lets suppose it execute statements ...then sizeof(int),sizeof(node *) ...will always produce error because int a

Re: [algogeeks] C Problem

2011-09-17 Thread prasanth n
4,7..if we assume the sizeof(int) as 4 bytes.. On Sat, Sep 17, 2011 at 2:32 PM, abhinav gupta wrote: > Ans will be:4,5 > > > On Sat, Sep 17, 2011 at 2:23 PM, Sanjay Rajpal wrote: > >> #include >> int main() >> { >> int a=5; >> printf("Size : %d\n",sizeof( a =15/2)); >> printf("A is %d.",a);

Re: [algogeeks] C Problem

2011-09-17 Thread abhinav gupta
Ans will be:4,5 On Sat, Sep 17, 2011 at 2:23 PM, Sanjay Rajpal wrote: > #include > > int main() > { > int a=5; > printf("Size : %d\n",sizeof( a =15/2)); > printf("A is %d.",a); > } > > What will be the value of a now ? Plz explain. > Sanju > :) > > -- > You received this message because you

Re: [algogeeks] c problem

2011-09-04 Thread bharatkumar bagana
@priya: compiler thinks that " a++; " statement is correct... But for that to do...' a' should be of type modifiable ... so it gives error saying that "If u want to modify , that should be lvalue, so lvalue required" On Sun, Sep 4, 2011 at 2:27 AM, Yogesh Yadav wrote: > @Priya: > Because a

Re: [algogeeks] c problem

2011-09-03 Thread Yogesh Yadav
@Priya: Because a is *unmodifiable* LValue. When we are using a=a+1(a++) , this means that we are changing the *base address* of array a[], and that can not be possible due to Library files. On Sun, Sep 4, 2011 at 11:49 AM, priya ramesh < love.for.programm...@gmail.com> wrote: > @yogesh: Thanks

Re: [algogeeks] c problem

2011-09-03 Thread priya ramesh
@yogesh: Thanks a lot for the explaination. Good one indeed. Can you plz tell me y the compiler says lvalue required for the statement a++ when a is an lvalue?? -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email

Re: [algogeeks] c problem

2011-09-03 Thread Yogesh Yadav
@Priya: Lvalue is not a contant value. It can be modifiable or unmodifiable. Lvalue stands for location value that means that we can store some value here in this location and rvalue stands for read value that means that it can be stored at some location that is in memory having lvalue. Here in c

Re: [algogeeks] c problem

2011-09-03 Thread priya ramesh
if it is an l value, the compiler should say "cannot modify const value" instead it says "l value required" This statement proves that a is an r value in main. right?? -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, sen

Re: [algogeeks] c problem

2011-09-03 Thread sukran dhawan
@priya :array is a constant pointer to a non constant data remember On Sat, Sep 3, 2011 at 6:48 PM, priya ramesh wrote: > ok but y does the compiler say lvalue required if you perform a++?? > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" gr

Re: [algogeeks] c problem

2011-09-03 Thread sukran dhawan
lvalue On Sat, Sep 3, 2011 at 6:44 PM, himanshu kansal wrote: > an array is always an *unmodifiable* l-value. > > > On Sat, Sep 3, 2011 at 6:23 PM, priya ramesh < > love.for.programm...@gmail.com> wrote: > >> In main, any array say char a[200], >> a refers to an r value or an lvalue?? >>

Re: [algogeeks] c problem

2011-09-03 Thread priya ramesh
ok but y does the compiler say lvalue required if you perform a++?? -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsu

Re: [algogeeks] c problem

2011-09-03 Thread himanshu kansal
an array is always an *unmodifiable* l-value. On Sat, Sep 3, 2011 at 6:23 PM, priya ramesh wrote: > In main, any array say char a[200], > a refers to an r value or an lvalue?? > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. >

Re: [algogeeks] c problem

2011-06-08 Thread coder dumca
@harshalthanks , can u tell me how to find what features are compiler dependent On Wed, Jun 8, 2011 at 4:28 PM, Harshal wrote: > This depends upon the implementation. Hence, your program is not > portable. It's allowed to return NULL, and it's allowed to return a non-NULL > pointer. Both wa

Re: [algogeeks] c problem

2011-06-08 Thread Harshal
This depends upon the implementation. Hence, your program is not portable. It's allowed to return NULL, and it's allowed to return a non-NULL pointer. Both ways are sanctioned by the Standard. On Wed, Jun 8, 2011 at 4:20 PM, coder dumca wrote: > can any one tell me why this code perfectly runnin

Re: [algogeeks] C++ problem..

2011-05-25 Thread Aakash Johari
@balaji: that's the default value for the parameter. Basically, the advantage of the default parameter is that you need not to explicitly define the non-parameterized constructor. See the difference yourself with following 2 examples. 1) *class A { int m; A (int a

Re: [algogeeks] C++ problem..

2011-05-25 Thread Gaurav Saxena
Actually A(int *m=0*) > { > a=m; > } > not > A*(int m*) { >a = m; > } > means m has a default value of 0 ie this value will be used if no parameter is given . So when you pass it a parameter default value is simply ignored. On Wed, May 25, 2011 at 12:15 PM, Bal

Re: [algogeeks] C++ problem..

2011-05-24 Thread Balaji S
ya.. thanks :) it works. but.. we are initializing m to 0 in everycall ryt.. ? then how does 1,2,3,is initialized?? -- You received this 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] C++ problem..

2011-05-24 Thread Aakash Johari
Change it to that.. It will still work.. Don't worry :) On Tue, May 24, 2011 at 10:56 PM, Balaji S wrote: > but > constructor is > > > A(int *m=0*) > { > a=m; > } > not > > A*(int m*) { >a = m; > } > > ??? > > -- > You received this message because you are sub

Re: [algogeeks] C++ problem..

2011-05-24 Thread Balaji S
but constructor is A(int *m=0*) { a=m; } not A*(int m*) { a = m; } ??? -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from th

Re: [algogeeks] C++ problem..

2011-05-24 Thread Aakash Johari
This way you can do: #include > > using namespace std; > > class A { > public: > int a; > > A(int m) { > a = m; > } > > A() { > } > }; > > int main() > { > int i; > > A