C언어 float를 char배열로 변환

1 개요[ | ]

C언어 float-char배열 변환
C언어 float를 char배열로 변환
#include<stdio.h>
int main() {
  char buf[BUFSIZ];
  sprintf(buf, "%f", 3.14);
  printf("%s\n", buf);
  // 3.140000
}
#include<stdio.h>
int main() {
  char buf[BUFSIZ];
  sprintf(buf, "%.2f", 3.14);
  printf("%s\n", buf);
  // 3.14
}

2 같이 보기[ | ]

3 참고[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}