Re: [algogeeks] c++ query

2012-01-28 Thread atul anand
abc(const char*p) this means the string is const but pointer is not.. try this :- //suppose intially it was p=hello p=world; // this will work. *p='e'; // compile time error On Fri, Jan 27, 2012 at 6:08 PM, rahul sharma rahul23111...@gmail.comwrote: is this a type of fxn overloadingit

[algogeeks] c++ query

2012-01-27 Thread rahul sharma
int abc(char *); int abc(const char*); r theses same or different???...i m using dev comiler and it works..but isnt char is by default constant ??? -- 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] c++ query

2012-01-27 Thread sukhmeet singh
they are same untill u are reading from the memory . As soon as you try to modify or change .. it causes error. On Fri, Jan 27, 2012 at 2:32 PM, rahul sharma rahul23111...@gmail.comwrote: int abc(char *); int abc(const char*); r theses same or different???...i m using dev comiler and it

Re: [algogeeks] c++ query

2012-01-27 Thread rahul sharma
is this a type of fxn overloadingit should be allowed or not ? On Fri, Jan 27, 2012 at 4:37 PM, sukhmeet singh sukhmeet2...@gmail.comwrote: they are same untill u are reading from the memory . As soon as you try to modify or change .. it causes error. On Fri, Jan 27, 2012 at 2:32 PM,

Re: [algogeeks] C++ Query

2011-09-20 Thread abhinav gupta
Whenver you call copy constructor it has to pass reference parameter beacuse you dont want constructor and destructor to be called twice. Here is the reason why, Suppose u have two objects of a class (let 'a' and 'b'). when u want to copy 'a' into 'b' you want current status of object 'a' to be

[algogeeks] C++ Query

2011-09-19 Thread teja bala
Why do we pass a reference for copy constructors? If it does shallow copy for pass by value (user defined object), how will it do the deep copy? Ans:- if we don't pass the reference, every time a new object copy like A a=b; constructor will be called twice ,, correct me if i'm wrong... help

Re: [algogeeks] C++ Query

2011-09-19 Thread praveen raj
Yes u r saying correct . On 19-Sep-2011 6:39 PM, teja bala pawanjalsa.t...@gmail.com wrote: Why do we pass a reference for copy constructors? If it does shallow copy for pass by value (user defined object), how will it do the deep copy? Ans:- if we don't pass the reference, every time a

Re: [algogeeks] C++ Query

2011-09-19 Thread teja bala
@praveen how about shallow copy and deep copy of copy constructor? On Mon, Sep 19, 2011 at 6:53 PM, praveen raj praveen0...@gmail.com wrote: Yes u r saying correct . On 19-Sep-2011 6:39 PM, teja bala pawanjalsa.t...@gmail.com wrote: Why do we pass a reference for copy constructors?

[algogeeks] C++ Query

2011-09-19 Thread teja bala
Does anyone can xplain Function object or functor in C++ with example??? thx in advance. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this

Re: [algogeeks] C++ Query

2011-09-19 Thread prasanth n
@teja: if we use call by value in copy constructor,, class base { int a; public: base(int x) { a=x; } base(base c) { } }; int main() { base b(1); base b1=b;// this ll be seen as base c=b(see the copy constructor)..this ll in turn call another copy constructor.. return 0; } now it ll create

Re: [algogeeks] C++ Query

2011-09-19 Thread KARTHIKEYAN V.B.
Hi Can anyone say me which is the best hashing tecnicque which can store duplicates and minimize time complexity? Pls reply -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com.

[algogeeks] C query

2011-09-19 Thread teja bala
// Could some body plzz xplain dis code.. #includestdio.h void main() { long double lda=1e+37L,ldb=1e-37L; long double a[2]={1234,5678}; long long unsigned int x=0x1234; printf(%d %d %ld%ld %llx %d,sizeof(lda),lda,a[0],a[1],x,sizeof(x)); } -- You received this message

Re: [algogeeks] C++ Query...

2011-09-16 Thread Anup Ghatage
You create another class which has the same structure as the given class. and then create an object of the temporary class and typecast given object into this new class object, and then access its element. On Fri, Sep 16, 2011 at 10:04 AM, siddharam suresh siddharam@gmail.comwrote: i saw

[algogeeks] C++ Query...

2011-09-15 Thread teja bala
How to access class private data members with a pointer? thx in advance? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to

Re: [algogeeks] C++ Query...

2011-09-15 Thread bharatkumar bagana
@teja : r u looking for something like this... #includestdio.h #includestdlib.h class Hai { public : int* getPointerToPrivate() { return i; } void setI(int j) { i=j; } private: int i; }; main() { Hai h; h.setI(10); int

Re: [algogeeks] C++ Query...

2011-09-15 Thread teja bala
@ BHARATH exactly very thx On Thu, Sep 15, 2011 at 5:22 PM, bharatkumar bagana bagana.bharatku...@gmail.com wrote: @teja : r u looking for something like this... #includestdio.h #includestdlib.h class Hai { public : int* getPointerToPrivate() { return

Re: [algogeeks] C++ Query...

2011-09-15 Thread siddharam suresh
i saw better solution in stack over flow, but these things violates the Memory rules of C++ Thank you, Sid. On Thu, Sep 15, 2011 at 6:41 PM, teja bala pawanjalsa.t...@gmail.comwrote: @ BHARATH exactly very thx On Thu, Sep 15, 2011 at 5:22 PM, bharatkumar bagana

[algogeeks] c query

2011-06-23 Thread Anika Jain
#includestdio.h typedef struct { char *name; double salary; }job; main() { static job a={tcs,15000.0}; static job a={ibm,25000.0}; static job a={google,35000.0}; int x=5; job *arr[3]={a,b,c}; printf(%s %f\t,(3,x1)[*arr]); } output: google 35000.00 what

Re: [algogeeks] c query

2011-06-23 Thread Piyush Sinha
the comma operator evaluates its first operand and discards the result, and then evaluates the second operand and returns this value. instead of 3, whatever u write. the result will depend on the second operand i.e x1 i.e 2 (5/2 = 2) On 6/23/11, Anika Jain anika.jai...@gmail.com wrote:

Re: [algogeeks] c query

2011-06-23 Thread Piyush Sinha
for further details. http://en.wikipedia.org/wiki/Comma_operator On 6/23/11, Piyush Sinha ecstasy.piy...@gmail.com wrote: the comma operator evaluates its first operand and discards the result, and then evaluates the second operand and returns this value. instead of 3, whatever u write.

Re: [algogeeks] c query

2011-06-23 Thread Anika Jain
ya *arr[2] is fine but in printing a struct element do we need to give all necessary format specifiers for printing?? On Thu, Jun 23, 2011 at 7:15 PM, Piyush Sinha ecstasy.piy...@gmail.comwrote: for further details. http://en.wikipedia.org/wiki/Comma_operator On 6/23/11, Piyush Sinha

Re: [algogeeks] c query

2011-06-23 Thread Piyush Sinha
I had a doubt which I wanted to ask...for me output is coming as follows google 0.00 r u sure ur output is coming to be google 35000.00 On 6/23/11, Anika Jain anika.jai...@gmail.com wrote: ya *arr[2] is fine but in printing a struct element do we need to give all necessary format

Re: [algogeeks] c query

2011-06-23 Thread Anika Jain
in main by mistake i wrote all 3 vars of struct as a, make them as a , b , c.. ya it is google 35000.00 On Thu, Jun 23, 2011 at 7:35 PM, Piyush Sinha ecstasy.piy...@gmail.comwrote: I had a doubt which I wanted to ask...for me output is coming as follows google 0.00 r u sure ur

Re: [algogeeks] c query

2011-06-23 Thread Bhavesh agrawal
i got (null) 0.0 on my gcc compiler , is there any syntax error -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to

Re: [algogeeks] c query

2011-06-23 Thread Piyush Sinha
even I am getting output as google 0.0 On 6/23/11, Bhavesh agrawal agr.bhav...@gmail.com wrote: i got (null) 0.0 on my gcc compiler , is there any syntax error -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group,

Re: [algogeeks] c query

2011-06-23 Thread piyush kapoor
http://ideone.com/CJxFK give (null) 0.00 -- *Regards,* *Piyush Kapoor,* *CSE-IT-BHU* -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send

Re: [algogeeks] c query

2011-06-23 Thread Anika Jain
bt same code on my gcc gives google 35000.00.. On Fri, Jun 24, 2011 at 1:02 AM, piyush kapoor pkjee2...@gmail.com wrote: http://ideone.com/CJxFK give (null) 0.00 -- *Regards,* *Piyush Kapoor,* *CSE-IT-BHU* -- You received this message because you are subscribed to the Google

Re: [algogeeks] c query

2011-06-23 Thread D!leep Gupta
m also getting= google 35000.00 On Fri, Jun 24, 2011 at 1:25 AM, Anika Jain anika.jai...@gmail.com wrote: bt same code on my gcc gives google 35000.00.. On Fri, Jun 24, 2011 at 1:02 AM, piyush kapoor pkjee2...@gmail.comwrote: http://ideone.com/CJxFK give (null) 0.00 --