Question code
const std::vector<const char*> checkList = {
"midi_null_data"
};
Question contents
When declaring a variable called checkList, I understand const at the beginning, but I don't understand why the vector data type contains const again.
I wonder what you mean by the sample code related to midi communication.
c++
I don't know if it's accurate, but I'll answer it first.
First of all, the reason why the keyword const is added in front of it is a function that prevents modifying the original value of .
Here, vector const means that you do not want to change the source of the value of one container that stores the address of the const char.
And the data that one container is holding is a pointer called char.
So I think the reason why the character pointer has a const in front of it is to not modify the string when approaching the original.
I'm also a beginner
© 2024 OneMinuteCode. All rights reserved.