Arrays of Characters in C

Here are a few examples of char array problems:

1. Reversing a string: Write a program that takes a string as input and returns the string in reverse order.

For example, if the input is “hello”, the output should be “olleh”.

Click here to the Solution

2. Counting vowels: Write a program that takes a string as input and returns the number of vowels in the string.

For example, if the input is “hello”, the output should be 2.

3. Finding substrings: Write a program that takes two strings as input and checks if the first string contains the second string as a substring.

For example, if the input is “hello world” and “world”, the output should be true.

4. Converting case: Write a program that takes a string as input and converts all uppercase letters to lowercase letters and vice versa.

For example, if the input is “Hello World”, the output should be “hELLO wORLD”.

5. Counting words: Write a program that takes a string as input and returns the number of words in the string. For example, if the input is “The quick brown fox jumps over the lazy dog”, the output should be 9.

I hope these examples give you some inspiration for working with char arrays!

Arrays of Characters in C

For more information click here:Basics of C Programming

1 thought on “Arrays of Characters in C-1”

Leave a Comment