Thursday 18th April 2024
REGISTRATION
Online Fashion Store

CBSE eBooks

CBSE Guess > eBooks > Class XII > Computer Science By . Mr. MRK

Chapter – 9. Pointers

Previous Index Next

2007 Delhi

1.d. Find the output of the following program:

#include<iostream.h>
void main( )
{
int Array[]={4,6,10,12};
int *pointer=Array;
for(int I=1;I<=3;I++)
{
cout<<*pointer<<”#”;
pointer++;
}
cout<<endl;
for(I=1;I<=4;I++)
{
(*pointer)*=3;
--pointer;
}
for(I=1;I<5;I++)
cout<<Array[I-1]<<”@”;
cout<<endl;
}

2007 Outside Delhi

1.d. Find the output of the following program:

#include<iostream.h>
void main( )
{
int Numbers[]={2,4,8,10};
int *ptr=Numbers;
for(int C=1;C<3;C++)
{
cout<<*ptr<<”@”;
ptr++;
}
cout<<endl;
for(C=0;C<4;C++)
{
(*ptr)*=2;
--ptr;
}
for(C=0;C<4;C++)
cout<<Numbers[C]<<”#”;
cout<<endl;
}

Previous Index Next