For fewer initializers, refer to 4.9 Initialization in K&R and 6.7.8 Initialization in C99 standard.
#include <stdio.h>
// in bss section. static storage. initialized to 0
int global_array[10];
void global() {
int i;
printf("=== global ===\n");
for (i = 0; i < 10; i++)
printf("array[%d] = %d\n", i, global_array[i]);
}
void range() {
int i;
int array1[] = { [0 ... 1] = 10, [7 ... 9] = 8 };
printf("=== range ===\n");
for (i = 0; i < 10; i++)
printf("array[%d] = %d\n", i, array1[i]);
}
void no_initializers_for_array_on_stack() {
int i;
int array2[3];
printf("=== no_initializers_for_array_on_stack ===\n");
for (i = 0; i < 3; i++)
printf("array2[%d] = %d\n", i, array2[i]);
}
void fewer_initializers() {
int i;
// Sames as int array2[] = { [0] = 1} };
int array2[3] = {1}; //
printf("=== fewer_initializers ===\n");
for (i = 0; i < 3; i++)
printf("array2[%d] = %d\n", i, array2[i]);
}
int main(int argc, const char *argv[]) {
global();
no_initializers_for_array_on_stack();
range();
fewer_initializers();
return 0;
}
分享到:
相关推荐
6.5.3 Up-right diagonal scan order array initialization process 26 6.5.4 Horizontal scan order array initialization process 27 6.5.5 Vertical scan order array initialization process 27 7 Syntax and ...
WELCOME TO TURBO C 2.0 ---------------------- This README file contains important, last minute information about Turbo C 2.0. The HELPME!.DOC file on the COMMAND LINE/UTILITIES disk also answers ...
WELCOME TO TURBO C 2.01 ----------------------- This README file contains important, last minute information about Turbo C 2.01. The HELPME!.DOC file on the COMPILER/UTILITIES disk also answers many...
Value arrays - A container structure to maintain an array of generic values III. Tools Reference glib-mkenums - C language enum description generation utility glib-genmarshal - C code marshaller ...
//scan all sensors in array (buttons and sliders) CSD_UpdateAllBaselines(); //Update all baseline levels; //detect if any sensor is pressed if(CSD_bIsAnySensorActive()){ // Add user code ...
java虚拟机的运行机理的详细介绍 Inside the Java Virtual Machine ...Appendix C. Opcode Mnemonic by Opcode Appendix D. Slices of Pi: A Simulation of the Java Virtual Machine Index About the Author
BOUND Check Array Index Against Bounds BSF Bit Scan Forward BSR Bit Scan Reverse BT Bit Test BTC Bit Test and Complement BTR Bit Test and Reset BTS Bit Test and Set CALL Call Procedure CBW/CWDE ...
如果你是一位C++程序员,渴望对于底层知识获得一个完整的了解,那么Inside TheC++ Object Model正适合你。 目录: 本立道生(侯捷 译序) 前言(Stanley B.Lippman) 第0章 导读(译者的话) 第1章 关于对象...
support for the newer C++ array operators, new[] and delete[]. “C” callable allocation routines are supplied, including malloc()/free(). These routines are compatible in real-time with the C++ new ...
2. Call the initialization of step HashTaskList InitTaskList 3. StartTaskManager started calling the task manager ***** For a HashTaskList, the above two functions called only once 4. Call ...
#include<stdio.h> #define M 4 //资源数目A,B,C #define N 3//进程数目P1,P2,P3 #define Stacksize N*M*N//堆栈的大小此处数组的第一个数是堆栈指针,只是当前的...void Matrix_Initialization(int array1[][N]);
7.6.10.4 Array creation expressions 176 7.6.10.5 Delegate creation expressions 178 7.6.10.6 Anonymous object creation expressions 180 7.6.11 The typeof operator 181 7.6.12 The checked and unchecked ...
RSP-29299 CODEGEN bug in managed fields initialization, associated with new management operators. RSP-29271 [DelphiLSP] Code Insight adds unneeded () when changing procedures/functions RSP-29256 ...
mth_array_search(…) 175 mth_sort(…) 176 mth_sort_row(…) 177 mth_sort_column(…) 177 fem_geom_edge_length(…) 178 fem_geom_face_area(…) 178 fem_geom_elem_volume(…) 178 fem_geom_elem_location(…) ...
在大二学习C语言时,老师就建议不要使用“goto”,并说很少会用到。在这里也是我碰到的第一个建议使用“goto”的地方。“在追求效率的代码中使用goto语句仍是最好的错误恢复机制。”--《Linux设备驱动程序(第3版...
Disassembly of raw data buffers with byte initialization data now prefixes each output line with the current buffer offset. Disassembly of ASF! table now includes all variable-length data fields at ...
A B C D E F G H I J L P R S U V -------------------------------------------------------------------------------- A addCookie(Cookie) - Method in class javax.servlet.http.HttpServletResponseWrapper ...
% Hints: contents = get(hObject,'String') returns popupmenu contents as cell array % contents{get(hObject,'Value')} returns selected item from popupmenu handles.bushu = get(hObject,'value'); %获得...
PEP 489: Multi-phase extension module initialization Other Language Changes New Modules typing zipapp Improved Modules argparse asyncio bz2 cgi cmath code collections collections.abc ...
In prior revisions, VsGui would not report no filter found if a filter was present but still going through its power-up initialization. Now, a message box is posted to indicate that a filter was ...