摘要: void main(){ char str[18] ="t88355"; int num = atoi(str+1); //把字符串转换成整数,参数传递的是从某一位开始往后的所有字符,出现非数字字符都会转换失败,就是0 printf("%d\n",num); // 88355 } //字符串与整数之间的转换 #include #include ... 阅读全文
posted @ 2019-08-10 22:36 Coding_Changes_LIfe 阅读(763) 评论(0) 推荐(0) 编辑
摘要: //将某个字符串插入到一个字符串中,在hello cpp hello china中,在cpp后插入luoxu #include #include #include char * insertString(char *str, char *substr, char *source){ if (str == NULL || substr == NULL){ return... 阅读全文
posted @ 2019-08-10 17:27 Coding_Changes_LIfe 阅读(1550) 评论(0) 推荐(0) 编辑
摘要: //内存函数 #include #include #include void main2(){ //memset赋值函数 char str[45] = "hello luoxu hello c"; memset(str,'A',6); //第一个参数内存首地址,第二个参数要赋值的值,第三个参数从首地址前进多少个字节 printf("%s\n",str); //A... 阅读全文
posted @ 2019-08-10 12:22 Coding_Changes_LIfe 阅读(165) 评论(0) 推荐(0) 编辑