Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!gatech!psuvax1!wuarchive!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!mp.cs.niu.edu!ux1.cso.uiuc.edu!osiris.cso.uiuc.edu!gordon From: gordon@osiris.cso.uiuc.edu (John Gordon) Newsgroups: comp.lang.c Subject: Re: Question about pointer Message-ID: <1991Mar1.235912.25133@ux1.cso.uiuc.edu> Date: 1 Mar 91 23:59:12 GMT References: <2488@njitgw.njit.edu> Sender: usenet@ux1.cso.uiuc.edu (News) Distribution: usa Organization: University of Illinois at Urbana Lines: 22 yxz1684@hertz.njit.edu (Ying Zhu ee) writes: >main() >{ > char a[10], b[10], *p, *combine(); > strcpy( a, "horse" ); > strcpy( b, "fly" ); > p=combine(a, b); ^^^^^^^^^^^^^^^^ -> This is wrong. 'p' has not yet been correctly initialized. pointers need to be initialized before you can set them equal to something. You could change p's declaration to char p[256] and then do a strcpy(p, combine(a, b)); . --- John Gordon Internet: gordon@osiris.cso.uiuc.edu #include gordon@cerl.cecer.army.mil #include