Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site umcp-cs.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!think!harvard!seismo!umcp-cs!chris From: chris@umcp-cs.UUCP (Chris Torek) Newsgroups: net.lang.c Subject: Re: C programming hint Message-ID: <809@umcp-cs.UUCP> Date: Thu, 11-Jul-85 18:02:33 EDT Article-I.D.: umcp-cs.809 Posted: Thu Jul 11 18:02:33 1985 Date-Received: Sat, 13-Jul-85 10:22:17 EDT References: <899@teddy.UUCP> Organization: U of Maryland, Computer Science Dept., College Park, MD Lines: 13 Keywords: strncpy > I found a way to initialize an array of characters without using a loop. > Here is the method I used: > > char blanks[SIZE]; /* declare array of SIZE elements */ > blanks[0] = ' '; /* initialize 1st element */ > strncpy(blanks + 1, blanks, SIZE - 1); /* initialize entire array */ Beware, that won't work on Vax systems that use movc3 for string copies (probably Sys VR2V2.2.2.2... [sorry :-)] and 4.3 both). -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 4251) UUCP: seismo!umcp-cs!chris CSNet: chris@umcp-cs ARPA: chris@maryland