0
Make a program to allocate memory space for 10 integers and ask the user to enter 10 values. Later, print your respective memory address and content.
What I have to change in my program to make it work ?
#include <stdio.h>
#include <stdlib.h>
int main()
{
int i, *p;
p = (int*)malloc(10*sizeof(int));
if (!p);
{
printf("Nao foi possivel alocar o vetor !");
exit(0);
}
for(i=0; i<10; i++)
{
printf("Digite um valor: ");
scanf("%d", &p[i]);
}
for(i=0; i<10; i++)
{
printf("Endereço de memoria: %d\nConteudo: %d\n", &p[i], p[i]);
}
free(p);
return 0;
}