✅ NullReferenceException when declaring an array but not initializing it
Hello guys, say I created a new class and within that new class, I created an array.
So we have something like this:
Noticed that we didn't initialize numbers array. So what will happen if we try to access it? we get a NullReferenceException? If so, what is happening internally pls. Like when we declare
So we have something like this:
Noticed that we didn't initialize numbers array. So what will happen if we try to access it? we get a NullReferenceException? If so, what is happening internally pls. Like when we declare
int[] numbers, normally numbers should store a reference to where the array is on the heap, right? But since their is no "array" yet, numbers points to nothing, so to null?