I was just compiling a C file and made a typo: swapped argc[0]
for argv[0]
. This, of course, gave me an error message from gcc:
SlidingWindow_file.c:443:29: error: subscripted value is neither array nor pointer nor vector
This error message makes perfect sense to me, except for one thing: What is a vector in the context of plain C (seeing as how this was a C file, not C++)? I can't seem to find any information about such a thing.
A vector is a type of array you find in object-oriented languages like C++. Like arrays, they can store multiple data values. However, unlike arrays, they cannot store primitive data types. They only store object references – they point to the objects that contain the data instead of storing the objects themselves.
You can't. By definition, C knows nothing of any of the required components of a std::vector , including, but not limited to: C does not have namespaces, so it can't understand the std namespace. C does not have templates, so it can't understand the std::vector<T> type.
Unlike arrays, which have their size fixed when they are defined; vectors can be resized easily according to the requirement of the user. This provides flexibility and reduces the time requirement with arrays to copy the previous elements to the newly created array.
vector
in that error message refers to gcc vector extensions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With