# void\*\* notation

**URL:** <https://forums.developer.nvidia.com/t/void-notation/14586>\
**Category:** CUDA Programming and Performance\
**Created:** [January 26, 2010, 9:51pm UTC](https://forums.developer.nvidia.com/t/void-notation/14586 "2010-01-26T21:51:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mecasickle](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Mecasickle](https://forums.developer.nvidia.com/u/Mecasickle)\
**Post date:** [January 26, 2010, 9:51pm UTC](https://forums.developer.nvidia.com/t/void-notation/14586/1 "2010-01-26T21:51:56Z")

</div>

Hello, I’ve been sorking on some examples on the CUDA Zone Webpage. They’ve been running great without any problems, but I’m just curious about the cudaMalloc command:

cudaMalloc((void\*\*) &pointer, memorySize);

Ok so I’m familiar with pointer, where you usually just write : int \*apples;

But why does the void have two “\*” ??

I know that "void _" is a void pointer, but what does "void_\*"mean? Is it still a pointer? Is it just a matter of notation?

Looking for the answer on the web, but I can’t find ahything, jope you guys can help me with that theoritcail probelm I’m having…

Thank you!

---

<div class="post-metadata">

**Author:** ![avidday](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/avidday/32/59219_2.png) [@avidday](https://forums.developer.nvidia.com/u/avidday)\
**Post date:** [January 26, 2010, 9:56pm UTC](https://forums.developer.nvidia.com/t/void-notation/14586/2 "2010-01-26T21:56:56Z")

</div>

In C, void \*\* is “a pointer to a pointer”. You should find a discussion about what it means in just about any book or tutorial on C.

---

<div class="post-metadata">

**Author:** ![lixingjian](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@lixingjian](https://forums.developer.nvidia.com/u/lixingjian)\
**Post date:** [January 29, 2010, 3:29am UTC](https://forums.developer.nvidia.com/t/void-notation/14586/3 "2010-01-29T03:29:49Z")

</div>

> [@](#):
>
> Hello, I’ve been sorking on some examples on the CUDA Zone Webpage. They’ve been running great without any problems, but I’m just curious about the cudaMalloc command:
> 
> cudaMalloc((void\*\*) &pointer, memorySize);
> 
> Ok so I’m familiar with pointer, where you usually just write : int \*apples;
> 
> But why does the void have two “\*” ??
> 
> **I know that "void _" is a void pointer, but what does "void_\*"mean? Is it still a pointer? Is it just a matter of notation?**
> 
> Looking for the answer on the web, but I can’t find ahything, jope you guys can help me with that theoritcail probelm I’m having…
> 
> Thank you!

void \*\* is a pointer to “a void pointer”. For example: int v=0; int \*p=&v; void \*\*pp=&p;

p is a int pointer, pointing to v , and pp is a void\* pointer , pointing to p( storing the address of p).

You pass the address of param “pointer” to function cudaMalloc, and cudaMalloc will find a valid memory area and store the value( the address of the memory area) into “pointer” using its address which you pass to the function.

If you pass (void\*)pointer as a param to cudaMalloc, the allocated memory address will be stored in a temporary variebal in function cudaMalloc. So your param “pointer” won’t get the correct value.
