[algogeeks] Re: C doubt

2011-08-24 Thread Don
If you are working in C++, stl has a vector container class which will do this. Otherwise, declare an integer pointer in the struct and use malloc to allocate memory for it. Then you can use it like an array. Don On Aug 23, 11:51 pm, Arun Vishwanathan aaron.nar...@gmail.com wrote: say that you

Re: [algogeeks] Re: C doubt

2011-08-24 Thread sagar pareek
See if we use dynamic memory allocation then still the size of pointer will be 4 bytes only Mean that int* pointer still have the size equals to pointer ... malloc only returns new alloted memory which is now only *pointed *by that pointer check this out :- http://www.ideone.com/20ayq On

[algogeeks] Re: C doubt

2011-08-24 Thread Don
Yes, the memory provided by malloc will not be in the structure. Only the pointer to that memory will be in the structure. The size of a struct is defined at compile time, so it can't be dynamically sized at run time. struct junk { int size; int *data; }; Somewhere in the code: struct junk

Re: [algogeeks] Re: C doubt

2011-08-24 Thread Arun Vishwanathan
thanks guys! On Wed, Aug 24, 2011 at 6:37 PM, Don dondod...@gmail.com wrote: Yes, the memory provided by malloc will not be in the structure. Only the pointer to that memory will be in the structure. The size of a struct is defined at compile time, so it can't be dynamically sized at run

[algogeeks] Re: C++ doubt

2011-08-04 Thread Amit
static_cast does not do run time type checking. That's why base class pointer can be changed to drived class though it actually is a base class pointer. Now its a drived class pointer, you can call drived class functions. If you use dynamic_cast instead of static_cast, it will throw a bad cast

Re: [algogeeks] Re: C++ doubt

2011-08-04 Thread Shachindra A C
Hi Amit, Thanks for your reply. I digged out google and found out that this kind of conversion(downcasting from base class to derived class) can lead to unexpected behaviour. However, I fail to understand how the print function was actually called inspite of it not being in the base class. I

[algogeeks] Re: C doubt

2011-07-31 Thread Tyler Durden
Is it right?? declare an array of pointers like, int *func[N]; and since they are pointers to functions, modify above as, int (*func[N])(); -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit

Re: [algogeeks] Re: C doubt

2011-07-31 Thread ankit sambyal
yup its correct... -- You received this message because you are subscribed to the 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

Re: [algogeeks] Re: C doubt

2011-07-31 Thread Nikhil Gupta
If the function takes in an int argument, then is it modified to int (*func[N]) (int); ? On Sun, Jul 31, 2011 at 2:56 PM, ankit sambyal ankitsamb...@gmail.comwrote: yup its correct... -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To

Re: [algogeeks] Re: C doubt

2011-07-31 Thread Abhishek Gupta
@Nikhil yes. On Sun, Jul 31, 2011 at 3:02 PM, Nikhil Gupta nikhilgupta2...@gmail.comwrote: If the function takes in an int argument, then is it modified to int (*func[N]) (int); ? On Sun, Jul 31, 2011 at 2:56 PM, ankit sambyal ankitsamb...@gmail.comwrote: yup its correct... -- You

[algogeeks] Re: c doubt

2011-07-13 Thread Dave
No. It is unsigned. -- Dave On Jul 13, 9:28 am, Piyush Kapoor pkjee2...@gmail.com wrote: Shouldn't the value of 1100 be -64 On Wed, Jul 13, 2011 at 4:53 PM, Anika Jain anika.jai...@gmail.com wrote: binary equivalent of 5.2 is 101.0011001100110011001100110011(nonterminating)..

[algogeeks] Re: c++ doubt

2011-07-11 Thread deven
Thanks..This link is very useful. On Jul 10, 11:40 pm, Sandeep Jain sandeep6...@gmail.com wrote: http://www.parashift.com/c++-faq-lite/virtual-functions.html Its one of my favorite sites... :) Regards, Sandeep Jain On Mon, Jul 11, 2011 at 12:02 AM, himanshu kansal

[algogeeks] Re: c doubt

2011-07-04 Thread Sangeeta
ok,thanx On Jul 4, 12:29 pm, Vishal Thanki vishaltha...@gmail.com wrote: because \061 is considered as a single char in ur string.. On Mon, Jul 4, 2011 at 12:52 PM, Sangeeta sangeeta15...@gmail.com wrote: #Iincludestdio.h #includestring.h main() { char str[]=S\061AB;