MyComputerWorld
Labels
C PROGRAMS (Arrays Pointers and Structures)
(32)
Computer Tips and Tricks
(26)
Did You Know?
(18)
Downloads
(4)
Various Programs in C
(18)
Tuesday, 5 March 2013
Program to print the value and address of elements of an array using pointer notation
#include<stdio.h>
#include<conio.h>
main( )
{
clrscr();
int arr[5] = {5, 10, 15, 20, 25};
int i;
for(i=0; i<5; i++)
{
printf("Value of arr[%d] = %d\t", i,*(arr+i));
printf("Address of arr[%d] = %p\n",i,arr+i);
}
getch();
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment