Double Pointer - how to work with Arrays?

Hello, trying to call Array.GetData() return in this situation ** (double pointer)

FLinearColor UQAUserWidget::GetFirstButtonOriginalColor(TArray<class UButton*> Array)
	 if (Array.Num() == 0)
		UButton** Button =  Array.GetData();

		if (Button)
			OriginalButtonColor = Button->ColorAndOpacity();

How to work with it ?
I get an error:

Error C2227 left of ‘->ColorAndOpacity’ must point to class/struct/union/generic type QA

You got pointer to a pointer so you need to use * operator to get value that pointer is pointing to as you do with all pointers.


But there other issue, you accessing a raw C++ array, which are just memory offset from pointer which you access specific individual items in does offsets with [] operator. so it should be like this to access first element:


I don’t also unsafe as you can put any number in there and code will run without complain and potentially crash or you get trash data if you read it wrong, because you reading memory pointer with offset. You should use [] opeator on Tarray it self and safely operates the array, so:


will do the job just fine. Why you use GetData() in first place?

@Shadowriver thanks for reply !
Ah, sure I can use [] to get TArray object. Totally forgot about it. Just went straight into ->, double pointer blinded me a little, thanks !