With all due respect, mik3, the boilerplate link you provide for any and all questions about C or C++ is not very helpful.
It seems to me that you want a two-dimension array with an arbitrary number of rows and four columns. For such an array to change size at run time, you will need to allocate space for the original array from the heap, using malloc(). When the size changes, you will need to reallocate memory, which you can do by using realloc(). When your application doesn't need the memory any longer, use free() to return the heap memory. Look at the documentation of the standard library functions malloc, realloc, and free. All three are declared in stdlib.h.I'm working on a C program. I need to create a row with four columns whereby the length of the columns is determined at run time. I think I should use pointers but not sure how exactly to do it. Can someone assist me??
What is wrong with it?With all due respect, mik3, the boilerplate link you provide for any and all questions about C or C++ is not very helpful.
Yes, I found that tutorial, which is OK as far as it goes. C++ is vastly more complicated than C, especially in its OO aspects such as polymorphism, inheritance, data-hiding, and so on, not to mention other details like what happens when you don't provide a default constructor and/or copy constructor and/or destructor.
That's a link I know. If someone wants more he can search in google for more.Yes, I found that tutorial, which is OK as far as it goes. C++ is vastly more complicated than C, especially in its OO aspects such as polymorphism, inheritance, data-hiding, and so on, not to mention other details like what happens when you don't provide a default constructor and/or copy constructor and/or destructor.
My objection is that to any and all C or C++ questions, you provide that link and nothing else. IMHO, that's not much help. A better response, in my opinion, would at least provide the name of a topic that the poster could search for, to find information about what he/she is looking for.
Mark
Start a new threat if you need help.Hi,
I am a programmer and wants coding for menu in C++. Can you help me?
by Jake Hertz
by Duane Benson
by Jake Hertz
by Duane Benson