Download as pdf or txt
Download as pdf or txt
You are on page 1of 35

Demo: strcpy & strcat

Claudio Ciccotelli
int main() {
char s1[] = "Hello";
char s2[10] = "World";
char s3[12] = "Bye!";

strcpy(s3, s1);
strcat(s3, s2);

return 0;
}
char s1[] = "Hello";
char s2[10] = "World";
char s3[12] = "Bye!";

s1 H e l l o \0

s2 W o r l d \0

s3 B y e ! \0
strcpy(s3, s1);

s1 H e l l o \0

s2 W o r l d \0

s3 B y e ! \0
Destination Source
strcpy(s3, s1);

s1 H e l l o \0

s2 W o r l d \0

s3 B y e ! \0
Destination Source
strcpy(s3, s1);

s1 H e l l o \0

s2 W o r l d \0

s3 B y e ! \0
Destination Source
strcpy(s3, s1);

s1 H e l l o \0

s2 W o r l d \0

s3 H y e ! \0
Destination Source
strcpy(s3, s1);

s1 H e l l o \0

s2 W o r l d \0

s3 H y e ! \0
Destination Source
strcpy(s3, s1);

s1 H e l l o \0

s2 W o r l d \0

s3 H e e ! \0
Destination Source
strcpy(s3, s1);

s1 H e l l o \0

s2 W o r l d \0

s3 H e e ! \0
Destination Source
strcpy(s3, s1);

s1 H e l l o \0

s2 W o r l d \0

s3 H e l ! \0
Destination Source
strcpy(s3, s1);

s1 H e l l o \0

s2 W o r l d \0

s3 H e l ! \0
Destination Source
strcpy(s3, s1);

s1 H e l l o \0

s2 W o r l d \0

s3 H e l l \0
Destination Source
strcpy(s3, s1);

s1 H e l l o \0

s2 W o r l d \0

s3 H e l l \0
Destination Source
strcpy(s3, s1);

s1 H e l l o \0

s2 W o r l d \0

s3 H e l l o
Destination Source
strcpy(s3, s1);

s1 H e l l o \0

s2 W o r l d \0

s3 H e l l o
Destination Source
strcpy(s3, s1);

s1 H e l l o \0

s2 W o r l d \0

s3 H e l l o \0
Destination Source
strcpy(s3, s1);

s1 H e l l o \0

s2 W o r l d \0

s3 H e l l o \0
s1 H e l l o \0

s2 W o r l d \0

s3 H e l l o \0
strcat(s3, s2);

s1 H e l l o \0

s2 W o r l d \0

s3 H e l l o \0
Destination Source
strcat(s3, s2);

s1 H e l l o \0

s2 W o r l d \0

s3 H e l l o \0
Destination Source
strcat(s3, s2);

s1 H e l l o \0

s2 W o r l d \0

s3 H e l l o \0
Destination Source
strcat(s3, s2);

s1 H e l l o \0

s2 W o r l d \0

s3 H e l l o W
Destination Source
strcat(s3, s2);

s1 H e l l o \0

s2 W o r l d \0

s3 H e l l o W
Destination Source
strcat(s3, s2);

s1 H e l l o \0

s2 W o r l d \0

s3 H e l l o W o
Destination Source
strcat(s3, s2);

s1 H e l l o \0

s2 W o r l d \0

s3 H e l l o W o
Destination Source
strcat(s3, s2);

s1 H e l l o \0

s2 W o r l d \0

s3 H e l l o W o r
Destination Source
strcat(s3, s2);

s1 H e l l o \0

s2 W o r l d \0

s3 H e l l o W o r
Destination Source
strcat(s3, s2);

s1 H e l l o \0

s2 W o r l d \0

s3 H e l l o W o r l
Destination Source
strcat(s3, s2);

s1 H e l l o \0

s2 W o r l d \0

s3 H e l l o W o r l
Destination Source
strcat(s3, s2);

s1 H e l l o \0

s2 W o r l d \0

s3 H e l l o W o r l d
Destination Source
strcat(s3, s2);

s1 H e l l o \0

s2 W o r l d \0

s3 H e l l o W o r l d
Destination Source
strcat(s3, s2);

s1 H e l l o \0

s2 W o r l d \0

s3 H e l l o W o r l d \0
Destination Source
strcat(s3, s2);

s1 H e l l o \0

s2 W o r l d \0

s3 H e l l o W o r l d \0
s1 H e l l o \0

s2 W o r l d \0

s3 H e l l o W o r l d \0

You might also like