Search
 
SCRIPT & CODE EXAMPLE
 

CPP

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*/
Comment

PREVIOUS NEXT
Code Example
Cpp :: C++ Assignment Operators 
Cpp :: equal elements in two arrays in c++ 
Cpp :: check if a word is in map c++ 
Cpp :: aliasing c++ 
Cpp :: pre increment vs post increment c++ 
Cpp :: program to check smallest num in three numbers in c++ 
Cpp :: c++ error 0xC0000005 
Cpp :: sinonimo de tratar 
Cpp :: c++ how to skip the last element of vector 
C :: c colourful text 
C :: clear screen c 
C :: c get time in milliseconds 
C :: find factors of a number in c 
C :: octave square each element matrix 
C :: how to print boolean in c 
C :: Reduce fractions in C 
C :: see if two strings are equal in C 
C :: successeur ("123") 
C :: get current used proxy windows 7 
C :: console log observable data 
C :: matplotlib plot circle marker 
C :: mariadb utf8mb4 
C :: how do you make a copy of a linked list in c 
C :: accessing elements of 1d array using pointers 
C :: fgets function in c 
C :: plt legend top right outside 
C :: c check first character of string 
C :: C (ANSI) 
C :: linked list using c 
C :: c include delay 
ADD CONTENT
Topic
Content
Source link
Name
4+2 =