Posted by: Sourav | July 8, 2013

An Array’s elements and their addresses


#include <stdio.h>
void printarr(int a[]);
void printdetail(int a[]);

main()
{
int a[5];
int i;
for(i=0;i<5;i++)
{
a[i]=i;
}
printarr(a);
printdetail(a);
}
void printarr(int a[])
{
int i;
for(i=0;i<5;i++)
{
printf(“value in array %d\n”,a[i]);
}
}
void printdetail(int a[])
{
int i;
for(i = 0;i<5;i++)
{
printf(“value in array %d and address is %16lu\n”,a[i],&a[i]);

}
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: