1. c语言输出指针的值.
把pAdd打印到字符串里。
盗用一些楼上代码哈~
#include
<windows.h>
#include
<string.h>
void
main()
{
char
*pAdd;
char
str[20]
=
{0};
sprintf(str,
"%08x",
(long)
pAdd);
MessageBox(NULL,str,"My
程序",MB_OK);
}
2. c语言中如何借用指针输出字符串
使用指针输出字符串有以下几种方式:
1、使用printf 函数进行输出,其使用的格式转换符为%s,如
char*str="test";//指针指向一个字符串
printf("%s ",str);//输出str指向的字符串
2、使用puts函数进行输出,如
char*str="test";
puts(str);//输出str指向的字符串,会自动多输出一个换行
3、使用自定义函数进行输出,如
voidmyPuts(char*str)//自定义输出函数
{
if(!str)return;
while(*str!='