将整数转化成字符串并打印出错
//将整数转化成字符串并打印#include<stdio.h>
int main()
{
int num=12345,i=0;
char *str, *strtmp, *strcpy;
while(num)
{
*strtmp=num%10+'0';
num=num/10;
strtmp++;
i++;
}
strcpy=str;
while(i)
{
*str=*strtmp;
str++;
strtmp--;
i--;
}
*str='\0';
str=strcpy;
printf("%s",str);
}
提示:unhandled exception abc.exe:0xc000005:access violation
请问问题出在哪里?