INFO: Selective Initialization of Array Elements Not AllowedLast reviewed: August 26, 1997Article ID: Q39310 |
The information in this article applies to:
SUMMARYThe ANSI C standard does not allow selective initialization of array elements with the following syntax:
char MyArray[10] = {'a','b',,'d',,'f','g',,'i','j'};This attempt at selective initialization is not correct and will generate a "Syntax Error" at compile time as follows.
error C2059: syntax error : ','The following two declarations will compile and are valid declarations for Microsoft C version 5.1 and later:
Keywords : CLngIss Version : MS-DOS:6.0,6.00a,6.00ax,7.0; WINDOWS:1.0,1.5,1.51,1.52; WINDOWS NT:1.0,2.0,2.1,4.0,5.0 Platform : MS-DOS NT WINDOWS Issue type : kbinfo |
================================================================================
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |