Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!uunet!ficc!kunkee From: kunkee@ficc.uu.net (randy kunkee XNX MGR) Newsgroups: comp.lang.c Subject: C question -- pointer to array of characters Message-ID: <6569@ficc.uu.net> Date: 17 Oct 89 22:37:59 GMT Distribution: usa Organization: Unix/Xenix Support Group Lines: 31 Forget that you probably wouldn't want to do the following and consider the declaration: char (*foo)[]; This declares "foo" to be a pointer to an array of characters. My question is, how can you get an assignment to "foo" without the C compiler complaining about different levels of indirection (ie. make "foo" point to real storage) without using a typecast? For example: main() { char (*foo)[]; char bar[20]; foo = bar; } Does not work (well, it works, but the compiler complains). Is my C compiler broken? To put it another way, is there a declaration of "bar" that will make the above assignment compile silently, and which allocates storage for characters? -- Randy Kunkee Ferranti International Controls Corporation 12808 W. Airport Blvd. Sugar Land, TX 77478 UUCP: uunet!ficc!kunkee ph: (713) 274-5132