View the step-by-step solution to:


Define a function remainPos(...)  which receives one string (st) (with

letters, digits or special characters),one character (ch), and one digit (dig) (the digit will be greater or equal than 2, and clearly, since it is a digit, it will be less or equal than 9). Teh function should return a NEW STRING containing possibly several digits, separated by two dots. These digits in the returned string each are the remainder of dividing each position where the character (ch) is found by the digit (dig). Each remainder will be separated by two dots (and at the start and end of the string to be returned there should also be two dots). If the character ch  is the not present in the original string, then the function should return a string containing only two dots.

For example, 


s = "abc-abc-abc-abc-"

c = "a"

d = 3



will cause the function to return the string '..0..1..2..0..' because the character "a" is in positions 0,4,8,12 in the string s, and respectively, the remainders of dividing such positions by d (= 3) will produce the values 0,1,2,0 

As an example, the following code fragment:

s = "abc-abc-abc-abc-"

c = "a"


should produce the output:


Top Answer

Function (in C language): int giveMeRemainPos(char s[],char c,int d)/*definition of giveMeRemainPos() function. This... View the full answer

snip 3.JPG

Sign up to view the full answer

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question