A program to demonstrate the concept of DMA

Write a Program To demonstrate the concept of DMA.

#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
main()
{
int n, *p, i;
printf(“enter no. of elements:”);
scanf(“%d”, &n);
p= (int*) malloc (n* sizeof(int));
for(i=0; i<n; i++)
{
printf(“enter the number:”);
scanf(“%d”, (p+i));
}
for(i=0; i<n; i++)
{
printf(“%d\t”, *(p+i));
}
getch();
}

Output:

Program to demonstrate the concept of DMA in C Program

enter no. of Elements: 2

enter the number:3

enter the number:4

3              4

Leave a Reply

Your email address will not be published. Required fields are marked *