Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!zaphod.mps.ohio-state.edu!rpi!crdgw1!camelback!volpe From: volpe@camelback.crd.ge.com (Christopher R Volpe) Newsgroups: comp.lang.c Subject: Re: help with strcat Message-ID: <20249@crdgw1.crd.ge.com> Date: 5 Jun 91 12:16:55 GMT References: <1991Jun4.210209.28463@ux1.cso.uiuc.edu> Sender: news@crdgw1.crd.ge.com Reply-To: volpe@camelback.crd.ge.com (Christopher R Volpe) Distribution: comp Lines: 25 In article <1991Jun4.210209.28463@ux1.cso.uiuc.edu>, gordon@osiris.cso.uiuc.edu (John Gordon) writes: |>char *str1 = "Joseph went"; |>char *str2 ' " to the store."; |>char str3[100]; |> |>strcat(str3, str1); /* tacks str1 onto the end of str3 */ And where's the end of str3 if it hasn't been initialized? Use strcpy for the first component instead. |>strcat(str3, str2); /* tacks str2 onto the end of str3 */ |> |>/* str3 should now be "Joseph went to the store." */ |> |> |>--- |>John Gordon |>Internet: gordon@osiris.cso.uiuc.edu #include |> gordon@cerl.cecer.army.mil #include ================== Chris Volpe G.E. Corporate R&D volpecr@crd.ge.com