# C++ - Using Pointers as parameters/return for arrays

**URL:** <https://forums.unrealengine.com/t/c-using-pointers-as-parameters-return-for-arrays/364739>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine\
**Created:** [July 21, 2016, 9:41pm UTC](https://forums.unrealengine.com/t/c-using-pointers-as-parameters-return-for-arrays/364739 "2016-07-21T21:41:24Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![rantrod](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@rantrod](https://forums.unrealengine.com/u/rantrod)\
**Post date:** [July 21, 2016, 11:02pm UTC](https://forums.unrealengine.com/t/c-using-pointers-as-parameters-return-for-arrays/364739/3 "2016-07-21T23:02:40Z")

</div>

UFUNCTIONs are meant to be used in Blueprints. There’s no node to get addresses of variables in blueprints. Only UObjects or classes derived from them are references as pointers on the C++ side. Every other data type is passed by reference, including structs.

Your function would be more UE4-esque like this:

```
UFUNCTION(BlueprintCallable, Category = "Test")
void WaveClampedSine(int amplitude, int frequency, int phase, int num, UPARAM(ref) TArray<int> &Results);

```

…

```
void UYourUObjectClass::WaveClampedSine(int amplitude, int frequency, int phase, int num, TArray<int> &Results)
{
	for (int i = 0; i <= num; ++i)
	{
		Results.Add(amplitude * FMath::Sin(frequency * i + phase));
	}
}

```

---

_[View the full topic](https://forums.unrealengine.com/t/c-using-pointers-as-parameters-return-for-arrays/364739)._
