It is a data structure to store multiple variables
int marks[5];
int marks[5]={1,2,3,4,5};
int marks[]={1,2,3,4,5};
it will access by address
void changeArr(int arr[],int size){
for(int i=0;i<size;i++){
arr[i]=2*arr[i];
int main(){
int arr[]={1,2,3};
changeArr(arr,3);
for(int i=0;i<3;i++){
cout<<arr[i]<<endl; //value will change in the main function
//this is because of reference value
it is a search operation to find a target value in an array .use a loop and check every element one by one until you find the target value
for(int i=0;i<size;i++){
if(arr[i]==target){
return i;
}
}
return -1;
Time Complexity=O(n)
start and end pointer picked and swap .then increase of start value and decrease of end value and swap and repeat the process until start ≤ end
int st=0;
int en=size-1;
while(st<en){
swap(arr[st],arr[en]);
st++;
en--;
}
Time Complexity=O(n)