NO

Author Topic: Array initialisation  (Read 2914 times)

Gary Willoughby

  • Guest
Array initialisation
« on: January 09, 2010, 02:41:15 AM »
If i write this code outside of the main function, are the indexes initialised to '\0'?

Code: [Select]
char source[1000000];

JohnF

  • Guest
Re: Array initialisation
« Reply #1 on: January 09, 2010, 05:06:45 PM »
The answer is yes.

John

Gary Willoughby

  • Guest
Re: Array initialisation
« Reply #2 on: January 09, 2010, 05:49:19 PM »
Cool! Is this standard behaviour on all C99 compilers?

JohnF

  • Guest
Re: Array initialisation
« Reply #3 on: January 09, 2010, 07:55:05 PM »
Cool! Is this standard behaviour on all C99 compilers?

I believe it is a requirement.

John

Offline Vortex

  • Member
  • *
  • Posts: 802
    • http://www.vortex.masmcode.com
Re: Array initialisation
« Reply #4 on: January 10, 2010, 11:02:34 AM »
Hi Gary,

Why not to use a memory allocation function?
Code it... That's all...