On Thu, 14 Jan 1999, Canul Podkopayeva wrote:

> Why and how can I fix this code that segfault?
> #include <stdio.h>
> #include <stdlib.h>
> struct blah{
> char *answer;
> char *data;
> };
> struct haha{
> long value;
> struct blah dog;
> };
> struct haha *ga;
> int
> main(void)
> {
>      /* it sigfaults at this line */

       ga = (struct haha *) malloc( sizeof( struct haha ) );

>      ga->dog.answer = "a string!";
> printf("%s", ga->dog.answer);
> return (0);
> }
> 
> 
> 
> 
> _________________________________________________________
> DO YOU YAHOO!?
> Get your free @yahoo.com address at http://mail.yahoo.com
> 

-------------------------------------------------------------------------------
/* 
 * rck.h
 * Rim Chong-kyoon's contacting points
 * last updated on 1998.9.16
 */
#ifndef RCK_H
#define SNU_COMP_DEPT   [EMAIL PROTECTED]
#define NOWNURI         [EMAIL PROTECTED]
#define SSM             [EMAIL PROTECTED]      /* recommended */
#define HOMEPAGE        http://greentea.secsm.org/~hermes44/
#endif /* RCK_H */
-------------------------------------------------------------------------------

Reply via email to