Thread: concatenating more than 2 strings

  1. #1
    Registered User
    Join Date
    Nov 2005
    Posts
    4

    concatenating more than 2 strings

    Can you concatenate strings by using an operator, or is strcat the only way. Cuz what if you want to concatenate more than 2 strings together? I com from a vb background, and we use the + and the & operators. Does C have anything like this?

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    > Does C have anything like this?
    No.
    Use strcat() in a loop if you need to do this.

    But C++ strings support the + operator as meaning concatenate.

  3. #3
    Registered User
    Join Date
    Nov 2005
    Posts
    4
    thanks for the reply... Ill use a loop.

  4. #4
    Registered User
    Join Date
    Aug 2005
    Posts
    1,267
    you can also use sprintf() if you know how many strings need to be concantinated.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Easier way of concatenating a lot of strings?
    By Evenstevens in forum C Programming
    Replies: 2
    Last Post: 05-09-2009, 01:29 PM
  2. Concatenating C style Strings Question
    By bengreenwood in forum C++ Programming
    Replies: 3
    Last Post: 03-19-2009, 03:19 PM
  3. concatenating strings?
    By liri in forum C Programming
    Replies: 11
    Last Post: 08-24-2007, 05:34 PM
  4. Concatenating 2 strings
    By AngKar in forum C Programming
    Replies: 14
    Last Post: 04-25-2006, 10:51 AM
  5. Concatenating strings (dynamic array using pointers)
    By Tankndozer in forum C Programming
    Replies: 8
    Last Post: 07-01-2004, 07:27 AM