Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sdd.hp.com!news.cs.indiana.edu!arizona.edu!arizona!jtgorman Newsgroups: comp.sys.mac.programmer Subject: Char * and char[] Message-ID: <1569@caslon.cs.arizona.edu> From: jtgorman@cs.arizona.edu (J. Taggart Gorman) Date: 14 Jun 91 08:09:04 GMT Organization: U of Arizona CS Dept, Tucson Keywords: pointers, arrays Lines: 28 This is not a true Macintosh question, but I am posting it here because I know someone in this group will know, and besides, I have to ask this question because programming the Mac in C and using strings is enuf to drive one mad. This question deals with character arrays and pointers. In one of my data structures, I declare : char name[30]; Later, I declare : char *cp; and assign : cp = "\pNo Name"; Now, I try to somehow assign cp to name. I tried : theDecker.name = strcpy(cp, theDecker.name); and also theDecker.name = cp; THINK C complains of an illegal op. on an array. How the heck do I get a string constant into a character array??? | J. Taggart Gorman Jr. | "I'm a no rust build up man myself." | | -Christian Slater | jtgorman@caslon.cs.arizona.edu | in 'Heathers'