Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

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.
...