Will the follwing GLSL code work?
#version 330
uniform int size;
uniform float[size];
void main() {
//do something
}
No. The size of the array has to be a constant.
Specifically from the GLSL specification:
4.1.9 Arrays
...
When an array size is specified in a declaration, it must be an integral constant expression (see Section 4.3.3 “Constant Expressions” ) greater than zero.