Extension of first:he "help"

COCHRANE JIM T cochrane at spot.Colorado.EDU
Fri Sep 23 12:58:45 AEST 1988



/*	You missed two things, noted below in comments.		*/


struct string
   {
     char content;
     struct string *next;
   };
typedef struct string STRING;

main()
{
    STRING *stringptr;
    STRING *newstrptr;
    STRING *newstrel();		/*	newstrel needs to be declared; otherwise	*/
							/*	it's assumed to return an int.	*/
    newstrptr = newstrel(newstrptr);     
    (*newstrptr).content = 'a';   

}    

STRING *newstrel(sptr)		/*	'*' added	*/
STRING *sptr;
{
       sptr = ( STRING * ) malloc (sizeof(STRING));
       return sptr;
}
     



More information about the Comp.lang.c mailing list