how to replace an element in array in c++
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main(){
int arr[3] = {0,1,2};
cout << "Before update "<<arr[2]<<endl;
arr[2]=1;//updating element
cout <<"After update "<<arr[2]<<endl;
}
/*output:-
Before update 2
After update 1*/