If I use malloc() to increase the size of an array, would that always work, or would I sometimes get a memory error?
If I use malloc() to increase the size of an array, would that always
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It’ll “work” if you have enough memory. If you don’t have enough memory, then it will not work.
Now, when I say “work”, it depends what you mean by “work”.
mallocdoes not increase the size of anything other than your program’s memory usage.Why aren’t you using
std::vector?