#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
int main()
{
int a;
a = 123;
int * p = &a;
printf("p = %p\n",p);
printf("*p = %d\n",*p);
return 0;
} ```
```c
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
int main()
{
int *Ptr = NULL;
int i, j;
Ptr = (int *)malloc(1024000*sizeof(int));
if (NULL == Ptr)
{
printf("Error -- No Enough memory\n");
exit (1);
}
printf("Ptr = %p ",Ptr);
for(j=0;j<1024000;j++)
Ptr[j] = 0xcc;
printf("data = %d\n",Ptr[0]);
free(Ptr);
printf("Ptr = %p ",Ptr);
printf("data = %d\n",Ptr[0]);
Ptr = NULL;
return 0;
}
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
int main()
{
int *Ptr = NULL;
int i, j;
for(i=0;i<20;i++)
{
Ptr = (int *)malloc(1024000*sizeof(int));
if (NULL == Ptr)
{
printf("Error -- No Enough memory\n");
exit (1);
}
printf("Ptr = %p ",Ptr);
for(j=0;j<1024000;j++)
Ptr[j] = 0xcc;
printf("data = %d\n",Ptr[0]);
sleep(5);
}
while(1){
sleep(1000);
}
return 0;
}
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
int main()
{
int *Ptr = NULL;
int i, j;
for(i=0;i<20;i++)
{
Ptr = (int *)malloc(1024000*sizeof(int));
if (NULL == Ptr)
{
printf("Error -- No Enough memory\n");
exit (1);
}
printf("Ptr = %p ",Ptr);
for(j=0;j<1024000;j++)
Ptr[j] = 0xcc;
printf("data = %d\n",Ptr[0]);
sleep(5);
free(Ptr);
Ptr = NULL;
}
while(1){
sleep(1000);
}
return 0;
}