Question about pointer
John Gordon
gordon at osiris.cso.uiuc.edu
Sat Mar 2 10:59:12 AEST 1991
yxz1684 at 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 at osiris.cso.uiuc.edu #include <disclaimer.h>
gordon at cerl.cecer.army.mil #include <clever_saying.h>
More information about the Comp.lang.c
mailing list