Home >Backend Development >C#.Net Tutorial >What does %r mean in c language
In C language, the %r conversion specifier is used for: Formatted output: Print the address of a pointer variable, and the result is usually displayed in hexadecimal format. Formatted input: Read and store the input address into a pointer variable.
%r in C language is the conversion specifier for formatted output
%r is in C language Formatted output and input conversion specifiers commonly used in the printf() and scanf() functions. It is used to print or read the value of a pointer.
Formatted output (printf() function):
Formatted input (scanf() function):
Note: The
Example:
<code class="c">int main() { int *ptr = malloc(sizeof(int)); *ptr = 10; printf("Pointer value: %r\n", ptr); // 输出指针地址 scanf("%r", &ptr); // 从输入中读取指针地址 printf("Dereferenced pointer value: %d\n", *ptr); // 输出通过指针访问的值 return 0; }</code>
The above is the detailed content of What does %r mean in c language. For more information, please follow other related articles on the PHP Chinese website!