in netbeans ide this code works but here not can anyone help tnx :)

0 votes
asked Feb 26, 2018 by Bruno Daniel (180 points)

#include <stdlib.h>
#include <stdio.h>

void memaloca(int *a,int t)
{
    a=(int*)malloc(t*sizeof(int));
}

int main()
{
    int tam;
    int *v;
    printf("Insira o tamanho do vetor: ");
    scanf("%d",&tam);
    
   memaloca(v,tam);
    
    if(v)
    {
        
    
        for(int i=0;i<tam;i++)
        {
            printf("Insira o valor %d : \n",i+1);
            scanf("%d",&v[i]);
        }
    } else printf("Memoria insuficiente!");
    

    return 0;
}

1 Answer

0 votes
answered Mar 1, 2018 by anonymous
I tried your code and it seems to be working.
Here is link https://onlinegdb.com/r1Eg6cr_f
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...