abieth / coding-challenge_one

This repository was created for practicing coding, and it concerns what we have learned in the ALX software engineering program.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hi there 👋

115946188-cf20fe00-a4d4-11eb-811a-4b9d8f91fa34

coding-challenge_one

This repository was created for practicing coding, and it concerns what we have learned in the ALX software engineering program.

############ coding challenge(question) that include pointer, array, string, function, in c progaramming language #####

follow the following steps

  1. Add some discription about yourself to README.md file, at the root of the folder of the project like:
    • Your Name:
    • UserName:
    • tell as about yourself:

    • social media links:

    • and add also discribtion of the project

  2. Clone the repository to your local computer. in the repository and config your email < git config user.gmail > use that use also for github account
  3. create a branch in your local commputer and working on that (to protect main branch).
  4. Complete the tasks on your local computer within the new branch and push it to the repository.
  5. and on your github account request pull (pull request). (to merge to main branch if you sure about your code)
  6. done..........................get started (if you have any question or confusion let me know)

#### Coding-Challenge_One ######

1, Challenge: Count Vowels

Write a C function countVowels that accepts a string as an argument and returns the count of vowels (a, e, i, o, u, A, E, I, O, U) present in the string. and also create your test main file

  • Prototype: int countVowels( char* str);

  • Example: -------------

     --Input: "Hello, World!"
    
     --Output: 3
    

2, Challenge: Remove Duplicates from Array

Write a C function removeDuplicates that accepts an array of integers and its size as arguments. The function should modify the original array by removing any duplicate elements and return the new size of the array without duplicates. and also create your test main file and push it to repo

  • Prototype: int removeDuplicates(int* arr, int size);

  • Example: ------

      --int arr[] = {1, 2, 3, 2, 4, 3, 5};
    
      --int size = 7;
    
      --int newSize = removeDuplicates(arr, size);
    
      --// arr should be {1, 2, 3, 4, 5}
    
      --// newSize should be 5
    

3, Challenge: Remove Spaces from String

Write a C function removeSpaces that accepts a string as an argument and removes all the spaces from it. The function should modify the original string in-place using pointers. and also create your test main file and push it to repo

  • Prototype: void removeSpaces(char* str);

  • Example: -----

    --char str[] = "Hello, World! How are you?";
    
    --removeSpaces(str);
    
    --// str should be "Hello,World!Howareyou?"
    

4, Challenge: Remove Duplicates from String

Write a C function removeDuplicates that accepts a string as an argument and removes any duplicate characters from it. The function should modify the original string in-place using pointers. and also create your test main file and push it to repo

  • Prototype: void removeDuplicates(char* str);

  • Example: -----

    --char str[] = "Hello, World!";
    
    --removeDuplicates(str);
    
    --// str should be "Helo, Wrd!"
    

5, Challenge: Array Rotation

Write a C function rotateArray that accepts an array of integers and its size, along with a rotation count. The function should rotate the elements of the array to the right by the given rotation count in-place using pointers. and also create your test main file and push it to repo

  • Prototype: void rotateArray(int* arr, int size, int rotationCount);

  • Example: ----

     --int arr[] = {1, 2, 3, 4, 5};
    
     --int size = 5;
    
     --int rotationCount = 2;
    
     --rotateArray(arr, size, rotationCount);
    
     --// arr should be {4, 5, 1, 2, 3}
    

      ########################  Good luck, guys! I hope you will invite me to code with you again soon. ########################

About

This repository was created for practicing coding, and it concerns what we have learned in the ALX software engineering program.


Languages

Language:C 100.0%