Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
1 views5 pages

Arrays 1

Uploaded by

Mai Gado
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views5 pages

Arrays 1

Uploaded by

Mai Gado
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

#include<stdio.

h>

int main()
{
int [5] = {5, 1, 15, 20, 25};
int , , ;
= ++ [1];
= [1]++;
= [ ++];
printf("%d, %d, %d", , , );
return 0;
}

int a[5] = {5, 1, 15, 20, 25};

a[0] = 5 a[1] = 1 a[2] = 15 a[3] = 20 a[4] = 25

int i, j, m;

i = ++a[1]; i = ++1; i = 2 a[1] = 2

j = a[1]++; j = 2++; j = 2 a[1] = 3

m = a[i++]; m = a[2]; m = 15 i

printf("%d, %d, %d", i, j, m); i, j, m

#include<stdio.h>

int main()
{
static int [2][2] = {1, 2, 3, 4};
int , ;
static int * [] = {(int*) , (int*) +1, (int*) +2};
for( =0; <2; ++)
{
for( =0; <2; ++)
{
printf("%d, %d, %d, %d\n", *(*( + )+ ), *(*( + )+ ),
*(*( + )+ ), *(*( + )+ ));
}
}
return 0;
}

#include<stdio.h>

int main()
{
void fun(int, int[]);
int [] = {1, 2, 3, 4};
int ;
fun(4, );
for( =0; <4; ++)
printf("%d,", [ ]);
return 0;
}
void fun(int , int [])
{
int * =0;
int =0;
while( ++ < )
= & [ ];
* =0;
}

void fun(int, int[]); fun()

int arr[] = {1, 2, 3, 4};

a[0] = 1, a[1] = 2, a[2] = 3, a[3] = 4

int i; i

fun(4, arr);

for(i=0; i<4; i++) { printf("%d,", arr[i]); } for i


a

#include<stdio.h>
void fun(int ** );

int main()
{
int [3][4] = {1, 2, 3, 4, 4, 3, 2, 8, 7, 8, 9, 0};
int * ;
= & [0][0];
fun(& );
return 0;
}
void fun(int ** )
{
printf("%d\n", ** );
}
int a[3][4] = {1, 2, 3, 4, 4, 3, 2, 8, 7, 8, 9, 0}; a

int *ptr; *ptr

ptr = &a[0][0]; a
*ptr

fun(&ptr); &ptr a

fun(&ptr); printf("%d\n", **p);

*p a

**p

#include<stdio.h>

int main()
{
static int [] = {0, 1, 2, 3, 4};
int * [] = { , +1, +2, +3, +4};
int ** = ;
++;
printf("%d, %d, %d\n", - , * - , ** );
* ++;
printf("%d, %d, %d\n", - , * - , ** );
*++ ;
printf("%d, %d, %d\n", - , * - , ** );
++* ;
printf("%d, %d, %d\n", - , * - , ** );
return 0;
}

You might also like