đŸ§Ē C String Functions Practice Problems

⬅️ Back to C String Practice

đŸ§Ē C String Practice Problems (strcpy, strlen, strcmp, strcat, etc.)

Practice these problems to strengthen your understanding of string handling functions in C. These cover built-in functions like strcpy, strlen, strcmp, and more.

  1. Copy One String into Another
    Write a program that copies the string "Hello World" into another string using strcpy() and prints the copied string.
  2. Count Length of a String
    Take a string input from the user and find its length using strlen().
  3. Compare Two Strings
    Ask the user for two strings and compare them using strcmp(). Display whether they are equal or not.
  4. Concatenate Two Strings
    Write a program that takes two strings and joins them using strcat(). Print the final combined string.
  5. Reverse a String Manually
    Without using strrev(), write a custom function to reverse a string character by character.
  6. Check Palindrome
    Ask the user for a string and check if it is a palindrome (same forwards and backwards). Ignore case and spaces.
  7. Count Vowels and Consonants
    Write a program to count the number of vowels and consonants in a given string.
  8. Find the First Occurrence of a Character
    Input a string and a character, then find the first occurrence of that character using strchr().
  9. Find a Substring in a String
    Take two strings (main and search term) from the user. Use strstr() to find the substring’s position if it exists.
  10. Convert Lowercase to Uppercase
    Manually convert all lowercase letters in a string to uppercase using ASCII logic, without using strupr().

💡 Tip: All these problems require the use of #include <string.h> and some need basic loops and conditionals.

āĻ•োāύ āĻŽāύ্āϤāĻŦ্āϝ āύেāχ:

āĻāĻ•āϟি āĻŽāύ্āϤāĻŦ্āϝ āĻĒোāϏ্āϟ āĻ•āϰুāύ