c language to delete numeric characters in string

王林
Release: 2020-05-10 15:14:12
Original
10740 people have browsed it

c language to delete numeric characters in string

目的:

C语言实现删除字符串s中的数字字符。

具体代码如下:

// 删除数字 #include  #define N 100 int main(void) { char s[N]; int j,k; gets(s);// 输入字符串 for(j = k = 0;s[j]!='\0';j++)// 此循环用于删除字符串中的数字 if(s[j]<'0'||s[j]>'9') s[k++] = s[j]; s[k] = '\0';// 处理过的字符串加上结束标志'\0' puts(s);// 输出处理过的字符串 return 0; }
Copy after login

输出结果:

c language to delete numeric characters in string

推荐教程:c语言教程

The above is the detailed content of c language to delete numeric characters in string. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!