[Rd] Problems with calloc function.

From: Marcelo Damasceno <marcelodamasceno_at_gmail.com>
Date: Thu 29 Dec 2005 - 14:49:17 GMT


Hi all,

I have a C code in Linux, it has 7 pointers and compile e run OK, but when I run in R happens problems with calloc function, it returns NULL.

###############################################
> int *temp1,*temp2,*temp3,*temp4;

 temp1 = (int *)calloc(col,sizeof(int)); if(temp1 == NULL){

     printf("\n\n No Memory1!");
     exit(1);

}

  temp2 = (int *)calloc(col,sizeof(int));   if(temp2 == NULL){

        >printf("\n\n No Memory2!");
        >exit(1);

}

    temp3 = (int *)calloc(col,sizeof(int));     if(temp3 == NULL){

        >printf("\n\n No Memory3!");
        >exit(1);

}

    temp4 = (int *)calloc(col,sizeof(int));     if(temp4 == NULL){

        printf("\n\n No Memory4!");
        exit(1);

}

    int *cvector;
    cvector = (int *)calloc(col,sizeof(int));     if(cvector == NULL){

        printf("\n\n No Memory5!");
        exit(1);

}

    tam=ntam;

    int **matrix;
    matrix=(int**)calloc(row,sizeof(int*));     if(matrix == NULL){

        printf("\n\n No Memory6!");
        exit(1);

}

    temp=(int*)calloc(tam,sizeof(int));
    if(temp == NULL){

        printf("\n\n No Memory7!");
        exit(1);

}

    iia = (int *)calloc(row-1,sizeof(int));     if(iia == NULL){

        printf("\n\n No Memory8!");
        exit(1);

}

    iib = (int *)calloc(row-1,sizeof(int));     if(iib == NULL){

        printf("\n\n No Memory9!");
        exit(1);

}
############################################
In output !
> No Memory5!
>[marcelo@cocada01 home] $

What's wrong?
Thanks!

--
Marcelo Damasceno de Melo
Graduando em Ciência da Computação
Departamento de Tecnologia da Informação - TCI
Universidade Federal de Alagoas - UFAL
Maceió - Alagoas - Brasil
Projeto CoCADa - Construção do Conhecimento por Agrupamento de dados
+55 82 8801-2119

	[[alternative HTML version deleted]]


______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel

Received on Fri Dec 30 01:53:42 2005

This archive was generated by hypermail 2.1.8 : Mon 20 Feb 2006 - 03:21:35 GMT