I am reading the OpenGL Super Bible 7th edition and in one of the earliest chapters there is an example of shader source code written like this:
static const GLchar * vertex_shader_source[] =
{
"#version 450 core \n"
" \n"
"void main(void) \n"
// ... etc ...
};
Why is this code stored in an GLchar pointer source array variable?
I mean, isn't GLchar*
alone enough to store a certain number of consecutive bytes? i.e. why not:
static const GLchar* source = ...
or:
static const GLchar source[] = ...
Why do we have to use both *
and []
?
I understand static const
, so that's not a problem BTW.