al

来自「Algorithms for Image Processing and Comp」· 代码 · 共 31 行

TXT
31
字号
@c ----------------------------------------------------------------------
@node alloca, memory
@heading @code{alloca}
@subheading Syntax

@example
#include <stdlib.h>

void *alloca(int size);
@end example

@subheading Description

This function is similar to @xref{malloc}.  The difference is that the
memory allocated is in the current stack frame, so when the current
function exits the memory is automatically reclaimed.  You should
never call @code{free()} with a pointer returned by @code{alloca}.

@subheading Return Value

A pointer to the temporary memory.

@subheading Example

@example
char *x = alloca(20+strlen(y));
sprintf(x, "The value is %s", y);
return strdup(x);
@end example

⌨️ 快捷键说明

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