CompuServe Messages

need C help

    22-Mar-90 17:48:27
Sb: #95054-need C help
Fm: JEFFREY C. DEGE 76426,211
To: Henry Williams 76416,377
Have you ever looked at static initialization? Try: static int Array[] = {0,1,2,3,4,5,6,7,8,9}; This creates an array of 10 integers initialized to 0..9. Also, keep in mind that variables declared inside functions without the static keyword are allocated on the stack, while static variables and variables declared outside functions aren't. An array of 100 ints takes 400 bytes, which uses a good chunk of your stack space, and takes some time to initialize every time you enter the function. The larger the array gets, the worse it gets. So, in most cases, you want to declare large arrays outside of a function, or as static variables, or both.