Message from C, C++ talks

July 2019

— If no, I'll give up

— Use #include "interfaces/dataprovider.h"

— I changed library for another which is more simple and fast and which don't include the library which include the library which do the error

Message permanent page

— 👌

— 

I need little help

The size of my array should be the number of character user gives

If user gave input as 'aeroplane' in which characters are taken one at a time, then array size should become 9 because 'aeroplane' has 9 characters in it

How to do it?

— You can use std::vector if you're using C++ and call resize on it.
https://en.cppreference.com/w/cpp/container/vector

Or you can dynamically allocate the array if you're using C. Don't forget to delete it manually at the end.
http://www.cplusplus.com/doc/tutorial/dynamic/

Message permanent page

— I saw this on stackoverflow but i dont have any idea of this concept

IS there any other way

— Which one? Do you use C or C++?

— C++

— Well, std::vector is a template-based wrapper on dynamically allocated arrays, that you can resize dynamically, and use lots of things like alghorithms from STL. Also it has nice optimizations that go out of the box.

To use it you basically create an std::vector object giving it your type. Like std::vector<int> is something like a dynamic array of int elements.

Then you can work with it as with any array via square brackets. Or use other things like iterators. You can get the current size of array calling size function on it.

What else is not clear?

Message permanent page

— Other way would be to have a very big array and use only part of it (store the size that you're actually using in another variable).

Message permanent page

— But that comes with wasting memory and size limitations.

— How would i access it?

array[vector<int>] ??

— This is kind of what i wanted

— You could open the second link I gave you. It contains working examples