Making a function to take an object/component as input and return a FName for Component Tag of the passed object


I have been trying to pass a UActorComponent to a function named “gettagname”, and the below image is the “Get_Tag_Name.h” file. It shows the declaration of my function.


As I try to build the solution there is an error message saying pointer type is expected for “UActorComponent”. Can anybody help me get the code working?
I need this function to receive a actorcomponent as input and return a component tag.
below is the function definition “Get_Tag_Name.cpp”. where and what should I correct to get the solution.


Thank you

Try like this
static FName getagname(UActorComponent* Comp,int32 index);

FName getagname(UActorComponent* Comp,int32 index)
   FName tagname;
   tagname = Comp->ComponentTags[index];
   return tagname;

or in more easy way

Thank you so much Maksym Nosatov.
It worked.!