我有很多不同的方法来进行这种转换,但都失败了。我需要将 55 转换为字符串。
#include <stdio.h>
#include <stdlib.h>
int main(void) {
double time = 55;
char *buffer = ""; //char *buffer; doesnt work either
sprintf(buffer, "%d\n", time);//without newline doesnt work either
printf("%s",buffer);
}