Logo 
Search:

C Programming Articles

Submit Article
Home » Articles » C Programming » Homework HelpRSS Feeds

Program to display array values and address of an array using function and for loop

Posted By: Julia Hughes     Category: C Programming     Views: 4555

Write a program to display array values and address of an array using function and for loop.

Code for Program to display array values and address of an array using function and for loop in C Programming

#include <stdio.h>
void printarr(int a[]);
main()
{
int a[5];
for(int i = 0;i<5;i++)
{
a[i]=i;
}
printarr(a);
}
void printarr(int a[])
{
for(int i = 0;i<5;i++)
{
printf("value in array %d\n",a[i]);
}
}
void printdetail(int a[])
{
for(int i = 0;i<5;i++)
{
printf("value in array %d and address is %16lu\n",a[i],&a[i]);    \\ A
}
}
  
Share: 



Julia Hughes
Julia Hughes author of Program to display array values and address of an array using function and for loop is from London, United Kingdom.
 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!