求教一下:问什么这里编译通过,当运行时就出错?
#include<stdlib.h>#include <string.h>
#include<stdio.h>
int num;
char* arry;
void main(void)
{
int a=1234;
sprintf(arry, "%d",a);
printf("%s",arry);
}
----------------------------------------------------------------------------------------------------------------------
如果换成这样就好了,请问这是什么原因?
#include<stdlib.h>
#include <string.h>
#include<stdio.h>
int num;
char arry[20];
void main(void)
{
int a=1234;
sprintf(arry, "%d",a);
printf("%s",arry);
//uart_sendN(UART0,(uint8 *)arry,strlen(arry));
}