home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C Programming Starter Kit 2.0
/
SamsPublishing-CProgrammingStarterKit-v2.0-Win31.iso
/
tyc
/
list17_4.c
< prev
next >
Encoding:
Amiga
Atari
Commodore
DOS
FM Towns/JPY
Macintosh
Macintosh JP
NeXTSTEP
RISC OS/Acorn
Shift JIS
UTF-8
Wrap
C/C++ Source or Header
|
1993-10-16
|
337 b
|
20 lines
/* The strdup() function. */
#include <stdio.h>
#include <string.h>
char source[] = "The source string.";
main()
{
char *dest;
if ( (dest = strdup(source)) == NULL)
{
fprintf(stderr, "Error allocating memory.");
exit(1);
}
printf("The destination = %s", dest);
}