C++ 16 bit grayscale gradient image from 2D array?

I'm currently trying to build a 16 bit grayscale "gradient" image but my output looks weird so I'm clearly not under...

How to determine a Python variable's type??

How do I see the type of a variable whether it is unsigned 32 bit, signed 16 bit, etc.? How do I view it? ...