home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: sparky!uunet!psinntp!commpost!opus!fia!camelot!jogulin
- From: jogulin@camelot.fia.dmg.ml.com (Joseph Ogulin)
- Subject: Re: Computer terms, etc
- Message-ID: <1992Aug11.122117.25826@fia.dmg.ml.com>
- Sender: jogulin@camelot (Joseph Ogulin)
- Nntp-Posting-Host: camelot
- Organization: The Rift from Here to There
- References: <cee1.713424953@Isis.MsState.Edu>
- Date: Tue, 11 Aug 1992 12:21:17 GMT
- Lines: 37
-
- In article <cee1.713424953@Isis.MsState.Edu>, cee1@ra.msstate.edu (Charles Evans) writes:
- |> If anyone could help me, please define these for me:
- |> and what is the diff. between *foo[] and **foo?
-
- I haven't experienced one, but *foo[] is an array of character pointers
- and **foo is a pointer to a character pointer.
-
- |> whats the diff in these?
- |>
- |> char *foo = "abc";
- |> char *foo[] = "abc";
-
- What you have as *foo[] = "abc"; is an illegal declaration. You would have
- to declare it as follows:
-
- char *foo[] = { "abc", 0 };
-
- because you are declaring an array of pointers. I can't recall if the 0 is
- necessary in there (somebody help, I don't do those declarations normally).
-
- |> char foo[] = "abc";
- |> char foo[4] = "abc"; <--- is the '\0' autmatcially added?
-
- Yes, the '\0' is automatically added, and there is nothing wrong with that
- declaration, however, it is not good practice because what happens when you
- want to change the string? You have to be sure to change the size of the
- character array too.
-
- --
- ==> "You never f**king know the answer when it's important." --The Doctor <==
- Joe Ogulin
-
- jogulin@camelot.fia.dmg.ml.com joe@monroe.pilot.dmg.ml.com
- jogulin@apollo.stevens-tech.edu gcs_jogulin@stevens.bitnet
-
- Disclaimer: The above article is solely my opinion and does not necessar-
- ily reflect that of my employer. The content is my responsibility alone.
-