FromRawPointer

FromRawPointer[p]

返回指针 p 引用的值,用于编译代码.

FromRawPointer[array,offset]

返回 C 数组在偏移处的值.

更多信息

  • FromRawPointer 仅在编译代码中可用.
  • 在无效输入上运行 FromRawPointer 可能会导致崩溃.
  • FromRawPointer 可以处理指针和数组.
  • FromRawPointer 的用法在 C 中近似等价于以下用法:
  • FromRawPointer[p]*p
    FromRawPointer[array,offset]array[offset]*(array+offset)

范例

打开所有单元关闭所有单元

基本范例  (1)

创建一个指向整数的指针,然后取消引用它:

范围  (1)

偏移  (1)

FromRawPointer 可以提取数组中的不同元素:

应用  (2)

表示一个库函数,通过修改指针返回它的结果:

编译一个使用该函数的程序:

表示一个用平方数序列填充 "CArray" 的库函数:

编译一个程序,使用 FromRawPointer 提取填充数组的元素:

Wolfram Research (2022),FromRawPointer,Wolfram 语言函数,https://reference.wolfram.com/language/ref/FromRawPointer.html.

文本

Wolfram Research (2022),FromRawPointer,Wolfram 语言函数,https://reference.wolfram.com/language/ref/FromRawPointer.html.

CMS

Wolfram 语言. 2022. "FromRawPointer." Wolfram 语言与系统参考资料中心. Wolfram Research. https://reference.wolfram.com/language/ref/FromRawPointer.html.

APA

Wolfram 语言. (2022). FromRawPointer. Wolfram 语言与系统参考资料中心. 追溯自 https://reference.wolfram.com/language/ref/FromRawPointer.html 年

BibTeX

@misc{reference.wolfram_2024_fromrawpointer, author="Wolfram Research", title="{FromRawPointer}", year="2022", howpublished="\url{https://reference.wolfram.com/language/ref/FromRawPointer.html}", note=[Accessed: 03-December-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_fromrawpointer, organization={Wolfram Research}, title={FromRawPointer}, year={2022}, url={https://reference.wolfram.com/language/ref/FromRawPointer.html}, note=[Accessed: 03-December-2024 ]}