R
Rodrick Brown
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int
main(void)
{
typedef struct
{
char **test;
}Testing;
Testing **p;
p = malloc(sizeof(Testing));
p[0]->test[0] = malloc(sizeof(Testing));
strncpy(p[0]->test[0],"Hello World",20);
printf("%s\n",p[0]->test[0]);
return EXIT_SUCCESS;
}
Why does the following crash ?
Not sure what i'm missing please advise thanks.
--
Unix Systems Engineer
The City of New York
Dept. of Information Technology
http://www.nyc.gov/doitt
rbrown[(@)]doitt.nyc.gov
http://www.rodrickbrown.com
#include <string.h>
#include <stdlib.h>
int
main(void)
{
typedef struct
{
char **test;
}Testing;
Testing **p;
p = malloc(sizeof(Testing));
p[0]->test[0] = malloc(sizeof(Testing));
strncpy(p[0]->test[0],"Hello World",20);
printf("%s\n",p[0]->test[0]);
return EXIT_SUCCESS;
}
Why does the following crash ?
Not sure what i'm missing please advise thanks.
--
Unix Systems Engineer
The City of New York
Dept. of Information Technology
http://www.nyc.gov/doitt
rbrown[(@)]doitt.nyc.gov
http://www.rodrickbrown.com