Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我可以在 OpenCL 函数中打印指针吗?我可以在内核函数中使用 printf 但是我找不到打印指针的方法。
是否有一些等效于以下内容?:
int *ptr = 5; printf("%p \n", (void *)ptr);
这有什么问题?
int x = 5; int *ptr; ptr = &x; printf("%p \n", ptr);
你不能ptr指出 5。指针必须指向内存:
ptr
堆栈:int x 或堆:int* ptr = new int(5)
int x
int* ptr = new int(5)