Programming Blog

This blog is about technical and programming questions and there solutions. I also cover programs that were asked in various interviews, it will help you to crack the coding round of various interviews

Friday, 22 December 2017

C program to declare memory of a variable dynamically

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

int main(void)
{
int *ptr;

ptr=(int*)malloc(sizeof(int));

printf("input an integer value: ");
scanf("%d",ptr);

printf("you entered: %d.\n",*ptr);

free(iVar);

}

No comments:

Post a Comment