Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!linus!philabs!seismo!hao!cires!nbires!ut-ngp!utastro!nather From: nather@utastro.UUCP Newsgroups: net.lang.c Subject: Re: "Re: Array Initialization - (nf)" Message-ID: <460@utastro.UUCP> Date: Sat, 9-Jul-83 19:42:16 EDT Article-I.D.: utastro.460 Posted: Sat Jul 9 19:42:16 1983 Date-Received: Mon, 11-Jul-83 00:06:17 EDT References: ihlpf.156 Lines: 27 I agree with davy that explicit initializations are wise, even when "guaranteed" initializations are promised. As an awk-ward example, try the following short program on "awk" which pre-initializes every variable, array or not: #! /bin/awk -f { a[i] = 12345 printf "a[%d] = %d ", a, i i = 0 printf "a[%d] = %d\n", a, i } Now, careful reading of the "awk" tutorial will tell you that "i" is initialized to the null string, which is often zero, but not always. (It is to printf in the above example, but *not* to the array locator). So the above is a no-no, but less obvious than one might guess. What is this doing in net.lang.c? Well, I use "awk" a lot to test out algorithms before casting them permanently into "C" -- it requires far less overhead to get a simple program written -- but the practice has its hazards. INITIALIZE! Ed Nather ...kpno!utastro!nather