Xref: utzoo comp.lang.c:27680 comp.unix.xenix:10984 Path: utzoo!censor!geac!jtsv16!uunet!snorkelwacker!mit-eddie!aryeh From: aryeh@eddie.mit.edu (Aryeh M. Weiss) Newsgroups: comp.lang.c,comp.unix.xenix Subject: Re: pointers - why dosn't this work? Message-ID: <1990Apr5.005044.29684@eddie.mit.edu> Date: 5 Apr 90 00:50:44 GMT References: <6067@ozdaltx.UUCP> <23467@mimsy.umd.edu> Reply-To: aryeh@eddie.MIT.EDU (Aryeh M. Weiss) Distribution: usa Organization: MIT EE/CS Computer Facilities, Cambridge, MA Lines: 28 In article <23467@mimsy.umd.edu> dbk@mimsy.umd.edu (Dan Kozak) writes: >From article <6067@ozdaltx.UUCP>, by root@ozdaltx.UUCP (root): >> This is driving me crazy! According to the C books, this should work, >> but yet I get core dumps when I compile and run it. Suggestions??? > >Sell that book. > >> #include >> #include >> main() >> { >> char b[1][20]; >> char *x="This is a test"; >> char *a[3]; > ^^^^^ this is a pointer to an array of 3 chars, but the ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ No way, Jose', this is an array of 3 pointers of type char. (A pointer to an array is just a pointer.) > array(s) that it points to have not been allocated > and it hasn't itself been initialized. > >Clever: dbk@mimsy.umd.edu | "For I was rolled in water, >Not-so-clever: uunet!mimsy!dbk | I was rolled out past the pier" - MoB ------------- ``I must go. Somewhere a bug is happening.'' --