Home Forums C Programming help combining strings

Viewing 1 reply thread
  • Author
    • #2151

      Hi, I’m a total newbie at this. I’m really struggling here. any help would be awsome!
      the instructions are: Include the string library functions strlen(), strcat(), and strncat() within a function having the prototype concat(char string1[], char string2[], int maxlength)

      Here is what I need to do:
      read in string 1
      read in string 2
      pass both strings to the concat function
      Once I am in the function, I need to get the length of both strings.
      if the length of string1 + the length of string 2 is greater than the maximum number of characters allowed
      use strncat and limit the number of characters copied to maximumnumber – length of string 1
      otherwise use strcat and copy all of string 2 into string 1

      I could use some help with the code. Not sure what I’m doing and again, any help would be great. thanks
      what I have so far is…

    • #3472

      Could try:

Viewing 1 reply thread
  • The forum ‘C Programming’ is closed to new topics and replies.