⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 alloca.c

📁 不错书对C++/C程序员很有用的大家不要错过.
💻 C
字号:
#include <stdio.h>
#include <malloc.h>

void some_function(size_t size)
 {
   int i;
   char *pointer;
   char stack_fix[1];

   stack_fix[0] = NULL;

   if ((pointer = alloca(size)) == NULL)
     printf("Error allocating %u bytes from the stack\n", size);
   else
     {
       for (i = 0; i < size; i++)    
         pointer[i] = i;
       printf("Allocated and used a buffer of %u bytes\n", size);
     }
 }


void main(void)
 {
   some_function(1000);
   some_function(32000);
   some_function(65000);
 }


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -