当前位置:网站首页>c语言字符串和数值之间的转换函数
c语言字符串和数值之间的转换函数
2022-06-09 10:53:00 【拉普拉强】
字符串转数值
#include <stdlib.h>
/* 字符串转int */
int atoi(const char *nptr);
/* 字符串转long */
long atol(const char *nptr);
/* 字符串转longlong */
long long atoll(const char *nptr);
/* atoll的废弃名称 */
long long atoq(const char *nptr);
/* 字符串转浮点数 */
double atof(const char *nptr);
/* 字符串转long */
long int strtol(const char *nptr, char **endptr, int base);
- nptr: 待转换的字符串
- endptr: 字符串中首个不能被转换的部分地址
- base: 表示原始字符串中的数值是以什么进制表示
/* 字符串转longlong */
long long int strtoll(const char *nptr, char **endptr, int base);
数值转字符串
#include <stdlib.h>
char *ultoa(unsigned long value, char *string, int radix);
char *ltoa(long value,char *string,int radix);
char *itoa(int value,char *string,int radix);
- value: 待转换的数值
- string: 转换后的字符串缓存地址
- redix: 以什么进制展示
- 返回值: 指向字符串的地址
边栏推荐
- [SystemVerilog data type] ~ data type, logic type, array
- P1110 [ZJOI2007]报表统计
- 版式设计三大原则
- [buuctf.reverse] 111_[b01lers2020]chugga_chugga
- MySQL 学习笔记-第三篇-索引、存储过程和函数、视图、触发器
- TiDB Cloud 上线 Google Cloud Marketplace,以全新一栈式实时 HTAP 数据库赋能全球开发者
- 百度 90 后程序员删改数据库被判刑,其称因对领导不满
- 一次内存泄漏的问题记录
- 使用 KubeKey 搭建 Kubernetes/KubeSphere 环境的“心路(累)历程“
- [buuctf.reverse] 109_ [FlareOn6]FlareBear,110_ [INSHack2018]Tricky-Part1
猜你喜欢

CVPR 2022 | PTTR: 基于Transformer的三维点云目标跟踪
![[buuctf.reverse] 104_ [FlareOn1]Shellolololol](/img/20/3dbafefe043dcf3921f15f40fd87d8.png)
[buuctf.reverse] 104_ [FlareOn1]Shellolololol

最全知识总结,初学者必看

Jingzhida rushes to the scientific innovation board: the annual revenue is 458million, and the SME fund is the shareholder

Object instantiation and access

处理链加载数据出错的可能原因-process chain loading error

字符串切割 group by

最新版,最新资料

Use the five number generalization method to determine the outliers in the data set

PerfDog发布全新指标,为游戏量身打造
随机推荐
This article takes you to understand gaussdb (DWS) [Gauss is not a mathematician this time]
No provider available for the service
MySQL learning notes - Chapter 5 - data backup and recovery, MySQL logs
flutter setState() called after dispose()
flutter 弹窗flutter_easyloading
使用 KubeKey 搭建 Kubernetes/KubeSphere 环境的“心路(累)历程“
Object instantiation and access
[buuctf.reverse] 105_[FlareOn6]Memecat Battlestation
How are string types organized in redis?
"Chinese characteristics" of Web3
本科毕设CTF平台-MarsCTF
redis中的string类型是怎么组织的?
The method of array traversal in JS
flex:1不等分的问题
力扣(LeetCode)159. 至多包含两个不同字符的最长子串(2022.06.08)
Quartz multiple schedulers + thread pool mode to schedule tasks separately
Openkruise v1.2: add persistentpodstate to realize stateful pod topology fixation and IP reuse
Monomer mode
The latest Camtasia 2022 free computer screen recording tool
In modern society, people are more and more dependent on semiconductor products