Pelles C forum

C language => Beginner questions => Topic started by: Gary Willoughby on January 09, 2010, 02:41:15 AM

Title: Array initialisation
Post by: Gary Willoughby on January 09, 2010, 02:41:15 AM
If i write this code outside of the main function, are the indexes initialised to '\0'?

char source[1000000];
Title: Re: Array initialisation
Post by: JohnF on January 09, 2010, 05:06:45 PM
The answer is yes.

John
Title: Re: Array initialisation
Post by: Gary Willoughby on January 09, 2010, 05:49:19 PM
Cool! Is this standard behaviour on all C99 compilers?
Title: Re: Array initialisation
Post by: JohnF on January 09, 2010, 07:55:05 PM
Quote from: Gary Willoughby on January 09, 2010, 05:49:19 PM
Cool! Is this standard behaviour on all C99 compilers?

I believe it is a requirement.

John
Title: Re: Array initialisation
Post by: Vortex on January 10, 2010, 11:02:34 AM
Hi Gary,

Why not to use a memory allocation function?