Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
1703233 Anurag
Output:-
1703233 Anurag
Experiment -11
Title of experiment:- Write a program to compare elements of 2 arrays using pointers.
Aim of experiment:- To understand concept of array and pointers.
Source code:-
#include<iostream>
using namespace std;
#include<conio.h>
int main()
{
int i,j,c,r=0;
int a[5],b[5];
for(i=0;i<5;i++)
{
cout<<"enter value of a"<<endl;
cin>>a[i];
}
for(j=0;j<5;j++)
{
cout<<"enter value of b"<<endl;
cin>>b[j];
}
for (c=0;c<5;c++)
{
if(*(a+c) == *(b+c))
{
r=r+1;
continue;
}
}
if (r==5)
{
cout<<"array are equal";
}
else
{
cout<<"array are not equal";
}
getch();
return 0;
}
1703233 Anurag
Output:-
1703233 Anurag