#include <stdio.h>
char *Get(void)
{
char p[]="hello world";
return p;
}
int main(void)
{
char *str=NULL;
str=Get();
printf(str);
}


6楼
这样可能是你想要的结果!!
char *Get(void)
{
char p[]="hello world";
char *a;
strcpy(a,p);
return a;
}
int main(void)
{
char *str=NULL;
str=Get();
printf(str);
getch();
}
char *Get(void)
{
char p[]="hello world";
char *a;
strcpy(a,p);
return a;
}
int main(void)
{
char *str=NULL;
str=Get();
printf(str);
getch();
}


10楼
char *Get(void)
{
char p[]="hello world";
return p;
}
这个函数在这里取什么作用,怎么看不明白了?
回复
打赏帖 | |
---|---|
VOFA+波形显示+JYD-31蓝牙发送和解析不定长数据被打赏10分 | |
宏定义和const关键字定义被打赏5分 | |
换取逻辑分析仪】STM32G4从入门到大师之五:ADC中断方式单路采集电压被打赏16分 | |
【换取逻辑分析仪】STM32G4从入门到大师之四:ADC查询方式单路采集电压被打赏14分 | |
【分享开发笔记,赚取电动螺丝刀】几个单片机I2S外设的BLCK时钟对比被打赏20分 | |
【功率监测与控制系统DIY活动成果贴】DIY功率计与LabVIEW数据采集被打赏100分 | |
【分享开发笔记,赚取电动螺丝刀】使用ESP32S3调试I2S音频模块MAX98357被打赏22分 | |
【Freertos】任务管理被打赏10分 | |
分享博世的两种不同的喷射系统模式被打赏5分 | |
汽车+开路实验与短路实验被打赏10分 |