array.c

来自「speech signal process tools」· C语言 代码 · 共 47 行

C
47
字号
/*******************************************************************************                                                                             **       Copyright (C) 1992-1995 Tony Robinson                                 **                                                                             **       See the file LICENSE for conditions on distribution and usage         **                                                                             *******************************************************************************/# include <stdio.h># include <stdlib.h>/* Changed by Jon Fiscus */# include <util/fob.h># include <sp/shorten/shorten.h>void *pmalloc(size) ulong size; {  void *ptr;#ifdef DOS_MALLOC_FEATURE  fprintf(stderr, "requesting %ld bytes: ", size);#endif  ptr = malloc(size);#ifdef DOS_MALLOC_FEATURE  if(ptr == NULL)    fprintf(stderr, "denied\n");  else    fprintf(stderr, "accepted\n");#endif  if(ptr == NULL)    perror_exit("malloc(%ld)", size);  return(ptr);}long **long2d(n0, n1) ulong n0, n1; {  long **array0;  if((array0 = (long**)pmalloc(n0 * sizeof(long*) +n0*n1*sizeof(long)))!=NULL){    long *array1 = (long*) (array0 + n0);    int i;    for(i = 0; i < n0; i++)      array0[i] = array1 + i * n1;  }  return(array0);}

⌨️ 快捷键说明

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