0% found this document useful (0 votes)
50 views

Array Program

This document discusses arrays in C programming. It defines an array a with 5 elements - 'a', 'b', 12, 13, 14. A for loop prints each element and its index. It then prints the continuous memory addresses of each element in the array, demonstrating that arrays are stored in contiguous memory locations. The document aims to explain that arrays allow storing of multiple values in successive memory locations.

Uploaded by

Pawan Kumar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
50 views

Array Program

This document discusses arrays in C programming. It defines an array a with 5 elements - 'a', 'b', 12, 13, 14. A for loop prints each element and its index. It then prints the continuous memory addresses of each element in the array, demonstrating that arrays are stored in contiguous memory locations. The document aims to explain that arrays allow storing of multiple values in successive memory locations.

Uploaded by

Pawan Kumar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

// Program of Array...Saying..Array means coninuous memory location only..

// Nothing other than this....Whatever You can store on those locations.


// By: Pawan Kumar
#include<stdio.h>
#include<conio.h>

int main()
a
{
int i;
int a[5]={'a','b',12,13,14};
for(i=0;i<5;i++)
a b 12 13 14
1000 1002 1004 1006 1008
{
printf("Printing element %d th of Array:",i);
if(i==0 || i==1)
{
a ,(a+1) ,(a+2),(a+3),(a+4)
printf("%c\n",a[i]);
} *a=*(1000)=a[0]
else
{
printf("%d\n",a[i]);
}
}
printf("\n\nPrinting continuous Address space of array a:\n");
printf("%u\n",a);
printf("%u\n",a+1);
printf("%u\n",a+2);
printf("%u\n",a+3);
printf("%u\n",a+4);

getch();
return(0);
}
/*
Output:

Printing element 0 th of Array:a


Printing element 1 th of Array:b
Printing element 2 th of Array:12
Printing element 3 th of Array:13
Printing element 4 th of Array:14
Printing continuous Address space of array a:
6422150
6422152
6422154
6422156
6422158
*/

You might also like