3.字符串处理函数之atoi atol atof

#include <stdlib.h>
int atoi(const char *nptr);
long atol(const char *nptr);
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

void test01()
{
        printf("%d\n", atoi("123")); //123
        printf("%d\n", atoi("123abc"));//123
        printf("%d\n", atoi("abc123"));//提取失败
        printf("%f\n", atof("3.14"));//3.14
}

int main()
{
        test01();
        return 0;
}

 

posted @ 2023-07-23 14:48  一代枭雄  阅读(18)  评论(0)    收藏  举报