Pointers
Pointers
Assignment : Pointers
void main( )
{
int b[] = {10,20,30,40,50};
int i ;
for (i=0; i<=4; i++ )
cout << * b +i ;
}
c.
void main( )
{
int b[] = {10,20,30,40,50};
int i , *k;
k = b;
for (i=0; i<=4; i++ )
cout << * k ;
}
d.
void main( )
{
int a[] = {2,4,6,8,10};
int i ;
change (a,5);
for (i=0; i<=4; i++ )
cout << a[i]<<#;
}
void change( int * b, int n)
{
int i;
for (i=0; i<=4; i++ )
*( b+i) = * (b+i)+5;
}
By Niti Arora
// Prototype declaration
By Niti Arora
// Prototype declaration