P180. Program to allocate dynamic memory for 1 integer, scan it and print it.

 

#include<stdio.h>

#include<stdlib.h>

void main()

{

        int *p;

        p=malloc(sizeof(int));

        printf("Enter the integer : ");

        scanf("%d",p);

        printf("%d\n",*p);

}

Comments