Initializing an array in C++


/ Published in: C++
Save to your folder(s)

Initializing an array in C++


Copy this code and paste it in your HTML
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. main() {
  5. int n[10];
  6.  
  7. for (int i = 0; i < 10; i++) {
  8. n[i] = 1;
  9. cout<<n[i]<<endl;
  10. }
  11. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.