C Program to Count Occurrences of Each Element in an Array

Here we’ll see how to write C program to count occurrences of each element in an array. The C program will check how many times a particular integer occurs in the array. This program first takes the array size and the array elements as input. It maintains another array of same size to keep the … Continue reading “C Program to Count Occurrences of Each Element in an Array”

C Program to List All Files Including Subdirectories

In the previous article, we saw how to list all files in a particular directory. That program does not display the files of the subdirecties. Here we’ll see how to display the files of the current direcory and of the subdirectories. The directory stucture could be arbitarily nested. The program here will display the files … Continue reading “C Program to List All Files Including Subdirectories”

C Program to List All Files in a Directory

Listing all files in a directory is a very common programming requirement. Here we’ll see how to read and display all file names in a directory using C directory entry (dirent) library. This program first opens the current directory (“.”) using opendir() function. In a loop, each entry in the directory is read using readdir() … Continue reading “C Program to List All Files in a Directory”

C Program to Replace All Occurrences of a Character by Another One in a String

Here we’ll see how to replace all occurrences of a character by another one in a string. Read also: C program to remove all occurrences of a character. This program first takes a string as input, then two characters. First character will be replaced by the second one. The replace_char() function replaces the find character … Continue reading “C Program to Replace All Occurrences of a Character by Another One in a String”

C Program to Remove all Occurences of a Character from a String

Here we’ll see how to remove all occurences of a character from a string. For example, if we remove the character ‘o‘ from the string “The quick brown fox jumps over the lazy dog“, the result will be “The quick brwn fx jumps ver the lazy dg“. All four occurneces of ‘o’ removed from the … Continue reading “C Program to Remove all Occurences of a Character from a String”

0
0
0
0
0
0