Program to read text from a file and display it on screen

Learn C @Rs. 999 Only

We will write a program in C that will read a text file character by character and displays it on the screen. In order to achieve it, we will use fopen function that will open the file from the disk. We will also use fgetc function which will read the file character by character and then display the content of the string character by character.

Learn C @Rs. 999 Only

C program to read a string and replaces every 5th character with “X”

The below program in C will accept a string from user. It will then process the string and replace every 5th character of the string with a character “X”.

Here is the C code.

C Output

C program to sort character array (string) in ascending order

Below is the simple C program that will accept the character string from the user, calculates the length of the string and performs sorting operation on the string. The program will sort the character array in ascending order and display the result string (character array).

Here we go,