how to replace an element in array in c 2b 2b

Solutions on MaxInterview for how to replace an element in array in c 2b 2b by the best coders in the world

showing results for - "how to replace an element in array in c 2b 2b"
Bradwin
31 Feb 2020
1#include<iostream>
2#include<bits/stdc++.h>
3using namespace std;
4int main(){
5	int arr[3] = {0,1,2};
6	cout << "Before update "<<arr[2]<<endl;
7	arr[2]=1;//updating element
8	cout <<"After update "<<arr[2]<<endl;
9}
10
11/*output:-
12Before update 2
13After update 1*/