Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.2 9/3/84; site teddy.UUCP
Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!think!harvard!talcott!panda!teddy!kps
From: kps@teddy.UUCP
Newsgroups: net.lang.c
Subject: C programming hint
Message-ID: <899@teddy.UUCP>
Date: Wed, 10-Jul-85 15:04:06 EDT
Article-I.D.: teddy.899
Posted: Wed Jul 10 15:04:06 1985
Date-Received: Fri, 12-Jul-85 03:27:18 EDT
Reply-To: kps@teddy.UUCP (Kesavan P. Srinivasan)
Organization: GenRad, Inc., Concord, Mass.
Lines: 14
Keywords: strncpy
Summary: initializing strings (arrays of characters)

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 */
		   ^^^       ^^^       ^^^
		    |         |         |
		destination  source   how many characters to copy 

The trick is to use strncpy in an almost recursive way.
Well, I hope you found this useful.