Home / Programs / Array limit value and an array element address are printed in this program
🚀 Programming Example

Array limit value and an array element address are printed in this program

👁 957 Views
💻 Practical Program
📘 Step Learning
Array limit value and an array element address are printed in this program

💻 Program Code

// in the following program, we can see how an array limit
// value and an array element address are printed


#include<stdio.h>
void printarray(int a[]);
void main()
{
	int a[15];
	int i;
	for( i = 0; i<15; i++)
	{
	a[i] = i;
	}
	printarray(a);
	printdetails(a);
}

void printarray(int a[])
{
	int i;
	for( i = 0; i<15; i++)
	{
	printf("Value in the array %d\n",a[i]);
	}
}

printdetails(int a[])
{
	int i;
	for( i = 0; i<15; i++)
	{
	printf("Value in the array %d  and the address is %u\n",a[i],&a[i]);
	}

}
                        

🖥 Program Output

Value in the array 0
Value in the array 1
Value in the array 2
Value in the array 3
Value in the array 4
Value in the array 5
Value in the array 6
Value in the array 7
Value in the array 8
Value in the array 9
Value in the array 10
Value in the array 11
Value in the array 12
Value in the array 13
Value in the array 14
Value in the array 0  and the address is 37813988
Value in the array 1  and the address is 37813992
Value in the array 2  and the address is 37813996
Value in the array 3  and the address is 37814000
Value in the array 4  and the address is 37814004
Value in the array 5  and the address is 37814008
Value in the array 6  and the address is 37814012
Value in the array 7  and the address is 37814016
Value in the array 8  and the address is 37814020
Value in the array 9  and the address is 37814024
Value in the array 10  and the address is 37814028
Value in the array 11  and the address is 37814032
Value in the array 12  and the address is 37814036

                            

📘 Explanation

Array limit value and an array element address are printed in this program
📚 Learning Subject

Master Programming Through Practical Examples

Improve your coding logic, problem-solving skills and programming confidence by practicing real-world examples with explanations.

🎯 How to learn from this example

First understand the algorithm carefully. Then study the program line-by-line and compare it with the output. Finally, review the explanation section to strengthen your logic and programming understanding.

🔥 Practice suggestion

Rewrite the program without looking at the code. Modify values, conditions or logic and run it again. This helps improve confidence and strengthens coding skills much faster.