Q. Write a program to print the elements
of a 1D integer array along with
memory address of each element using
pointer.
Ans:-
#include<stdio.h>
int main()
{
int i;
int a[5]={10,20,30,40,50};
int *p = a;
for(i = 0;i<=4;i++)
{
printf("value=
%d\n",a[i]);
p++;
}
return 0;
}
ALGORITHM
Step 1:- start
Step 2:- initilize the array
Step 3:-int a[5]={10,20,30,40,50}
Int *p=a;
Step 4:- printf("value= %d\n",a[i]);
p++;
Step 5:- stop
FLOWCHART
0 Comments