正在加载图片...
Q. Can I declare more than 64K of global variables? A. You may have a total of up to 64k global and static data in the Tiny, Small, Medium, Compact and Large memory models the Huge model, the maximum is 64K per source module. Q. How do i dec lare an array thats greater than 64K? A. Arrays greater than 64K must be allocated off the heap If for example you wanted a two-dimensional array of characters that was 1024 by 128, the declaration you would expect to write would be char array [1024][128] But since the size of this array is greater than 64K, it must be allocated off the heap An example of this is #include <alloc. h> char (huge array)[128] maino array farcalloc(sizeof (array), 1024) The array can be accessed with the same code as an array not allocated off the heap. For example i= array[30][56] i the value stored at the 3lst by 57th element The use of the huge keyword is necessary in the declaration f array since only a huge pointer can address ob ject greater than 64k. For further discussion of huge pointers refer to the Users guide Q. How do I interface Turbo C routines to a Turbo Pascal program? A. See the example programs CPASDEMO PAs and CPASDEMO C on disk.Q. Can I declare more than 64K of global variables? A. You may have a total of up to 64K global and static data in the Tiny, Small, Medium, Compact and Large memory models. In the Huge model, the maximum is 64K per source module. Q. How do I declare an array that's greater than 64K? A. Arrays greater than 64K must be allocated off the heap. If, for example you wanted a two-dimensional array of characters that was 1024 by 128, the declaration you would expect to write would be: char array[1024][128]; But since the size of this array is greater than 64K, it must be allocated off the heap. An example of this is: #include <alloc.h> char (huge *array)[128]; : main() { : array = farcalloc(sizeof(*array), 1024); : } The array can be accessed with the same code as an array not allocated off the heap. For example: i = array[30][56]; will assign "i" the value stored at the 31st by 57th element in "array". The use of the "huge" keyword is necessary in the declaration of "array" since only a huge pointer can address objects greater than 64k. For further discussion of huge pointers, refer to the User's Guide. Q. How do I interface Turbo C routines to a Turbo Pascal program? A. See the example programs CPASDEMO.PAS and CPASDEMO.C on disk
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有