---
title: "Koppla ihop strängar."
type: "forum-thread"
url: "https://www.webforum.nu/amne/c-cpp/97578-koppla-ihop-strängar"
topic: "C/C++"
topic_url: "https://www.webforum.nu/amne/c-cpp"
author: "The_datanörd"
published: "2004-02-17T18:36:28.000Z"
updated: "2004-02-17T22:52:27.000Z"
replies: 2
views: 272
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/c-cpp/97578-koppla-ihop-strängar"
---

# Koppla ihop strängar.

## #1 — The_datanörd, 2004-02-17T18:36Z

char hej\[5\];
char nej\[5\];
char hej\[\] = "hello";
char nej\[\] = "world";
char tvo\[10\];

nu vill ja kopla ihop hej\[\] och nej\[\] så dom blir som en , tvo\[\]
ska innehålla "hello world"

Permalänk: https://www.webforum.nu/p/97578

## #2 — Viktor, 2004-02-17T18:46Z

```
strcpy(tvo,hej);
strcat(tvo," ");
strcat(tvo, nej);
```

"hello world" finns nu i tvo.

/Viktor

Permalänk: https://www.webforum.nu/p/1279210

## #3 — PeW, 2004-02-17T22:52Z

Du måste även inkludera string.h i din fil för att komma åt de funktioner som Viktor tipsade om:

```
#include <string.h>
```

Permalänk: https://www.webforum.nu/p/1279348

---

Tråden på webben: https://www.webforum.nu/amne/c-cpp/97578-koppla-ihop-strängar
