Question
Using Pointers,
- Write the character-counting function
- Write the string-concatenation program
Answer :
Word Count : 377
______ ____ ___ ______ ________ _________ _________ _____ ____.
______ _______ _____ ________ ________.
______ ______ ______ ___ ________ ____ ___.
_______ _______ _________ _____ _________ __________ _________ ____ _____ __________ __________.
_____ __________ _____ ____ ______ _________ ________.
_____ ____ _______ ______ ________ ________ ______ ______ ________.
_________ _____ ________ ______ _______ _________ __________ ____ _______ _____ ___ _____.
__________ ____ _________ _____ ____ _______ __________ ________ __________.
_____ _______ __________ ____ _________ _________ ____ ____ __________ ______.
_________ ____ ______ __________ ________ _______ __________ ________ ___ _____ _____ __________.
___ _____ ________ ______ _________ ______ ______ _____ ________ _____ _________ __________.
___ _____ ____ ______ _________ ______.
_________ _________ _________ __________ ________ _______ ___ ____ __________ ______ __________.
__________ _____ ______ ______ __________ _______.
____ _____ _____ ____ ______.
______ _______ ____ _________ ________ __________.
____ ____ ________ ______ ________.
_____ __________ _______ __________ _________.
____ ______ ____ __________ _______ _____.
__________ _______ ____ ____ ____ ____ ____.
__________ ____ _____ __________ _________ _______ ____ _____.
_________ ___ ________ ____ _____ _____ ___ _________ _____.
_____ ___ ________ _________ _________ _____ _____ ____ _______.
_________ ________ _____ _______ _____ __________ _________ ________ ________ ____ _____ __________.
_________ _______ ___ _____ ___ ___ ______ _____ _____.
___ ____ ________ __________ _________ ___ ___ ___.
_____ ______ _______ ________ __________ _________ __________ ______ ______ ____ ______.
____ _____ ___ _______ _______ ______ _____.
_______ _________ ___ __________ ____ __________ _______ ______ _________ _______ _____ ____.
__________ ______ _________ _________ ______ ______ ________ __________.
_______ _______ _______ ______ _______ ______.
__________ ________ _____ ________ ____ ________ ______ _______ ______ _______.
_____ ____ _____ __________ ___ _______ __________ ______.
___ _____ ________ ___ ________ _____ ______ __________ ____ ____.
Skip in 10
Character-Counting Function:
To write a function that counts the occurrence of a specific character in a string using pointers, we can iterate through the string and compare each character with the given one.
Here’s the code to count the occurrences of a character in a string:
#include <stdio.h> int count_characters(const char *str, char ch) { int count = 0; // Loop through the string until the null-terminator while (*str != '\0') { if (*str == ch) { count++; } str++; // Move to the next character in the string ______ _______ _____ ________ ________.
______ ______ ______ ___ ________ ____ ___.
_______ _______ _________ _____ _________ __________ _________ ____ _____ __________ __________.
_____ __________ _____ ____ ______ _________ ________.
_____ ____ _______ ______ ________ ________ ______ ______ ________.
_________ _____ ________ ______ _______ _________ __________ ____ _______ _____ ___ _____.
__________ ____ _________ _____ ____ _______ __________ ________ __________.
_____ _______ __________ ____ _________ _________ ____ ____ __________ ______.
_________ ____ ______ __________ ________ _______ __________ ________ ___ _____ _____ __________.
___ _____ ________ ______ _________ ______ ______ _____ ________ _____ _________ __________.
___ _____ ____ ______ _________ ______.
_________ _________ _________ __________ ________ _______ ___ ____ __________ ______ __________.
__________ _____ ______ ______ __________ _______.
____ _____ _____ ____ ______.
______ _______ ____ _________ ________ __________.
____ ____ ________ ______ ________.
_____ __________ _______ __________ _________.
____ ______ ____ __________ _______ _____.
__________ _______ ____ ____ ____ ____ ____.
__________ ____ _____ __________ _________ _______ ____ _____.
_________ ___ ________ ____ _____ _____ ___ _________ _____.
_____ ___ ________ _________ _________ _____ _____ ____ _______.
_________ ________ _____ _______ _____ __________ _________ ________ ________ ____ _____ __________.
_________ _______ ___ _____ ___ ___ ______ _____ _____.
___ ____ ________ __________ _________ ___ ___ ___.
_____ ______ _______ ________ __________ _________ __________ ______ ______ ____ ______.
____ _____ ___ _______ _______ ______ _____.
_______ _________ ___ __________ ____ __________ _______ ______ _________ _______ _____ ____.
__________ ______ _________ _________ ______ ______ ________ __________.
_______ _______ _______ ______ _______ ______.
__________ ________ _____ ________ ____ ________ ______ _______ ______ _______.
_____ ____ _____ __________ ___ _______ __________ ______.
___ _____ ________ ___ ________ _____ ______ __________ ____ ____.
IGNOU ACADEMY
Your IGNOU journey, made easier.
- Solved Assignments
- Study Notes
- Guess Papers
- Question Papers
Continue Reading — It's Free
Sign in with Google to unlock more of this answer.
✓ Free access
✓ Unlock up to 60% of the answer
✓ No payment required
✓ Unlock up to 60% of the answer
✓ No payment required
Quick Google sign-in. No separate registration form.