C Program to Remove all Characters in a String Except Alphabets - Source Code, Output & Execution Flow
C Program to Remove all Characters in a String Except Alphabets
This tutorial explains c program to remove all characters in a string except alphabets with C source code, sample output, and step-by-step execution flow.
#include <stdio.h>
int main() {
char str[] = "P2r@o!g#r4a%m", result[50];
int i, j = 0;
for (i = 0; str[i]; i++)
if ((str[i] >= 'A' && str[i] <= 'Z') || (str[i] >= 'a' && str[i] <= 'z')) result[j++] = str[i];
result[j] = '