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 Wed, Aug 24, 2011 at 8:10 PM, Don <dondod...@gmail.com> wrote: > 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 have a structure with some fields of known size and unknown > > size.For example, a char, an integer and an integer array.I do not know > the > > size of the integer array until the user mentions the number of bytes he > > needs this integer array to cover in the command line as an argument.Is > it > > possible to have a structure with an integer dynamic array? > > > > Arun > > > > -- > > "People often say that motivation doesn't last. Well, neither does > bathing > > - that's why we recommend it daily." > > -- > 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 group at > http://groups.google.com/group/algogeeks?hl=en. > > -- **Regards SAGAR PAREEK COMPUTER SCIENCE AND ENGINEERING NIT ALLAHABAD -- 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 group at http://groups.google.com/group/algogeeks?hl=en.