功能:将一个字符串转化为long类型

案例

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>

int main(void)
{
    // 字符类型
    // char ch[] = " -123456abc"; 只会打印数字、非数字停止
    char ch[] = "  -12.3456";
    // 转换类型
    long i = atol(ch);
    // 转换为long类型
    printf("%d\n", i);
    return 0;
}
atol 使用案例

相关文章:

  • 2021-06-11
  • 2022-12-23
  • 2021-12-20
  • 2021-12-19
  • 2021-09-18
  • 2022-01-02
  • 2022-12-23
  • 2022-02-10
猜你喜欢
  • 2022-01-26
  • 2021-12-03
  • 2021-12-21
  • 2021-08-21
  • 2022-12-23
  • 2021-07-03
相关资源
相似解决方案