{"action":"created","comment":{"url":"https://api.github.com/repos/FreeCodeCamp/wiki/pulls/comments/65378312","id":65378312,"diff_hunk":"@@ -4,6 +4,58 @@ Internally, `array` is a kind of data structure that can store a fixed-size sequ\n \n `array` consists of contiguous memory locations. The lowest address corresponds to the first element and the highest address to the last element.\n \n+\n+## Arrays in C++\n+\n+C++ provides a data structure, `array`, which stores a fixed-size sequential collection of elements of the same data-type. An `array` is used to store a collection of data, but it is better to think of an `array` as a collection of variables of the same type.\n+\n+#### Declaration of `array`\n+\n+```cpp\n+\n+int intarray[10]; // Declares an array of integer type of size 10 with elements having random values. Index ranges from 0 to 9(i.e. size-1).\n+int intarray[10] = { 0 }; // Declares an array of integer of size 10 with all elements having value 0\n+\n+// Choose one the two declarations and then move ahead.\n+\n+```\n+\n+#### Inserting elements to `array`:\n+\n+```cpp\n+\n+intarray[0] = 1; // Inserts an integer value of 1 at index 0\n+intarray[1] = 0; // Inserts an integer value of 0 at index 1\n+intarray[2] = -1; // Inserts an integer value of -1 at index 2\n+intarray[3] = 1; // Inserts an integer value of 1 at index 3\n+\n+```\n+\n+#### Printing an `array`:\n+\n+```cpp\n+\n+std::cout << intarray[0] << std::endl; // Returns 1 which is element at index of the array\n+std::cout << intarray[11] << std::endl; // A random number is expected, while in reality this is `dangerous`, and is primary cause of crashes as it's accessing a memory location which does not exist.\n+\n+// To print all the elements of the array\n+for(int i = 0; i < n; i++)\n+\tstd::cout << intarray[i] << std::endl;\n+","path":"Data-Structure-Arrays.md","position":41,"original_position":41,"commit_id":"dbb4c729f3a942c3333d3356098ec3e01d81d0cb","original_commit_id":"dbb4c729f3a942c3333d3356098ec3e01d81d0cb","user":{"login":"atjonathan","id":11198912,"avatar_url":"https://avatars.githubusercontent.com/u/11198912?v=3","gravatar_id":"","url":"https://api.github.com/users/atjonathan","html_url":"https://github.com/atjonathan","followers_url":"https://api.github.com/users/atjonathan/followers","following_url":"https://api.github.com/users/atjonathan/following{/other_user}","gists_url":"https://api.github.com/users/atjonathan/gists{/gist_id}","starred_url":"https://api.github.com/users/atjonathan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/atjonathan/subscriptions","organizations_url":"https://api.github.com/users/atjonathan/orgs","repos_url":"https://api.github.com/users/atjonathan/repos","events_url":"https://api.github.com/users/atjonathan/events{/privacy}","received_events_url":"https://api.github.com/users/atjonathan/received_events","type":"User","site_admin":false},"body":"Remove this line","created_at":"2016-06-01T15:01:21Z","updated_at":"2016-06-01T15:01:21Z","html_url":"https://github.com/FreeCodeCamp/wiki/pull/1074#discussion_r65378312","pull_request_url":"https://api.github.com/repos/FreeCodeCamp/wiki/pulls/1074","_links":{"self":{"href":"https://api.github.com/repos/FreeCodeCamp/wiki/pulls/comments/65378312"},"html":{"href":"https://github.com/FreeCodeCamp/wiki/pull/1074#discussion_r65378312"},"pull_request":{"href":"https://api.github.com/repos/FreeCodeCamp/wiki/pulls/1074"}}},"pull_request":{"url":"https://api.github.com/repos/FreeCodeCamp/wiki/pulls/1074","id":72183879,"html_url":"https://github.com/FreeCodeCamp/wiki/pull/1074","diff_url":"https://github.com/FreeCodeCamp/wiki/pull/1074.diff","patch_url":"https://github.com/FreeCodeCamp/wiki/pull/1074.patch","issue_url":"https://api.github.com/repos/FreeCodeCamp/wiki/issues/1074","number":1074,"state":"open","locked":false,"title":"Update : Data Structures : Arrays","user":{"login":"jainaman224","id":13117482,"avatar_url":"https://avatars.githubusercontent.com/u/13117482?v=3","gravatar_id":"","url":"https://api.github.com/users/jainaman224","html_url":"https://github.com/jainaman224","followers_url":"https://api.github.com/users/jainaman224/followers","following_url":"https://api.github.com/users/jainaman224/following{/other_user}","gists_url":"https://api.github.com/users/jainaman224/gists{/gist_id}","starred_url":"https://api.github.com/users/jainaman224/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jainaman224/subscriptions","organizations_url":"https://api.github.com/users/jainaman224/orgs","repos_url":"https://api.github.com/users/jainaman224/repos","events_url":"https://api.github.com/users/jainaman224/events{/privacy}","received_events_url":"https://api.github.com/users/jainaman224/received_events","type":"User","site_admin":false},"body":"#1044","created_at":"2016-06-01T13:50:04Z","updated_at":"2016-06-01T15:01:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bb4caa4dc53472caf47c32a629e0cd38dc111842","assignee":{"login":"koustuvsinha","id":5122822,"avatar_url":"https://avatars.githubusercontent.com/u/5122822?v=3","gravatar_id":"","url":"https://api.github.com/users/koustuvsinha","html_url":"https://github.com/koustuvsinha","followers_url":"https://api.github.com/users/koustuvsinha/followers","following_url":"https://api.github.com/users/koustuvsinha/following{/other_user}","gists_url":"https://api.github.com/users/koustuvsinha/gists{/gist_id}","starred_url":"https://api.github.com/users/koustuvsinha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/koustuvsinha/subscriptions","organizations_url":"https://api.github.com/users/koustuvsinha/orgs","repos_url":"https://api.github.com/users/koustuvsinha/repos","events_url":"https://api.github.com/users/koustuvsinha/events{/privacy}","received_events_url":"https://api.github.com/users/koustuvsinha/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/FreeCodeCamp/wiki/pulls/1074/commits","review_comments_url":"https://api.github.com/repos/FreeCodeCamp/wiki/pulls/1074/comments","review_comment_url":"https://api.github.com/repos/FreeCodeCamp/wiki/pulls/comments{/number}","comments_url":"https://api.github.com/repos/FreeCodeCamp/wiki/issues/1074/comments","statuses_url":"https://api.github.com/repos/FreeCodeCamp/wiki/statuses/dbb4c729f3a942c3333d3356098ec3e01d81d0cb","head":{"label":"jainaman224:data-structures-arrays","ref":"data-structures-arrays","sha":"dbb4c729f3a942c3333d3356098ec3e01d81d0cb","user":{"login":"jainaman224","id":13117482,"avatar_url":"https://avatars.githubusercontent.com/u/13117482?v=3","gravatar_id":"","url":"https://api.github.com/users/jainaman224","html_url":"https://github.com/jainaman224","followers_url":"https://api.github.com/users/jainaman224/followers","following_url":"https://api.github.com/users/jainaman224/following{/other_user}","gists_url":"https://api.github.com/users/jainaman224/gists{/gist_id}","starred_url":"https://api.github.com/users/jainaman224/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jainaman224/subscriptions","organizations_url":"https://api.github.com/users/jainaman224/orgs","repos_url":"https://api.github.com/users/jainaman224/repos","events_url":"https://api.github.com/users/jainaman224/events{/privacy}","received_events_url":"https://api.github.com/users/jainaman224/received_events","type":"User","site_admin":false},"repo":{"id":59271925,"name":"wiki","full_name":"jainaman224/wiki","owner":{"login":"jainaman224","id":13117482,"avatar_url":"https://avatars.githubusercontent.com/u/13117482?v=3","gravatar_id":"","url":"https://api.github.com/users/jainaman224","html_url":"https://github.com/jainaman224","followers_url":"https://api.github.com/users/jainaman224/followers","following_url":"https://api.github.com/users/jainaman224/following{/other_user}","gists_url":"https://api.github.com/users/jainaman224/gists{/gist_id}","starred_url":"https://api.github.com/users/jainaman224/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jainaman224/subscriptions","organizations_url":"https://api.github.com/users/jainaman224/orgs","repos_url":"https://api.github.com/users/jainaman224/repos","events_url":"https://api.github.com/users/jainaman224/events{/privacy}","received_events_url":"https://api.github.com/users/jainaman224/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jainaman224/wiki","description":"Free Code Camp's wiki articles","fork":true,"url":"https://api.github.com/repos/jainaman224/wiki","forks_url":"https://api.github.com/repos/jainaman224/wiki/forks","keys_url":"https://api.github.com/repos/jainaman224/wiki/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jainaman224/wiki/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jainaman224/wiki/teams","hooks_url":"https://api.github.com/repos/jainaman224/wiki/hooks","issue_events_url":"https://api.github.com/repos/jainaman224/wiki/issues/events{/number}","events_url":"https://api.github.com/repos/jainaman224/wiki/events","assignees_url":"https://api.github.com/repos/jainaman224/wiki/assignees{/user}","branches_url":"https://api.github.com/repos/jainaman224/wiki/branches{/branch}","tags_url":"https://api.github.com/repos/jainaman224/wiki/tags","blobs_url":"https://api.github.com/repos/jainaman224/wiki/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jainaman224/wiki/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jainaman224/wiki/git/refs{/sha}","trees_url":"https://api.github.com/repos/jainaman224/wiki/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jainaman224/wiki/statuses/{sha}","languages_url":"https://api.github.com/repos/jainaman224/wiki/languages","stargazers_url":"https://api.github.com/repos/jainaman224/wiki/stargazers","contributors_url":"https://api.github.com/repos/jainaman224/wiki/contributors","subscribers_url":"https://api.github.com/repos/jainaman224/wiki/subscribers","subscription_url":"https://api.github.com/repos/jainaman224/wiki/subscription","commits_url":"https://api.github.com/repos/jainaman224/wiki/commits{/sha}","git_commits_url":"https://api.github.com/repos/jainaman224/wiki/git/commits{/sha}","comments_url":"https://api.github.com/repos/jainaman224/wiki/comments{/number}","issue_comment_url":"https://api.github.com/repos/jainaman224/wiki/issues/comments{/number}","contents_url":"https://api.github.com/repos/jainaman224/wiki/contents/{+path}","compare_url":"https://api.github.com/repos/jainaman224/wiki/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jainaman224/wiki/merges","archive_url":"https://api.github.com/repos/jainaman224/wiki/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jainaman224/wiki/downloads","issues_url":"https://api.github.com/repos/jainaman224/wiki/issues{/number}","pulls_url":"https://api.github.com/repos/jainaman224/wiki/pulls{/number}","milestones_url":"https://api.github.com/repos/jainaman224/wiki/milestones{/number}","notifications_url":"https://api.github.com/repos/jainaman224/wiki/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jainaman224/wiki/labels{/name}","releases_url":"https://api.github.com/repos/jainaman224/wiki/releases{/id}","deployments_url":"https://api.github.com/repos/jainaman224/wiki/deployments","created_at":"2016-05-20T06:51:39Z","updated_at":"2016-05-20T06:51:41Z","pushed_at":"2016-06-01T14:22:24Z","git_url":"git://github.com/jainaman224/wiki.git","ssh_url":"git@github.com:jainaman224/wiki.git","clone_url":"https://github.com/jainaman224/wiki.git","svn_url":"https://github.com/jainaman224/wiki","homepage":"http://www.freecodecamp.com/wiki","size":370856,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"FreeCodeCamp:master","ref":"master","sha":"6fae38832c94f5f8c5a82873360aeada17c0a49d","user":{"login":"FreeCodeCamp","id":9892522,"avatar_url":"https://avatars.githubusercontent.com/u/9892522?v=3","gravatar_id":"","url":"https://api.github.com/users/FreeCodeCamp","html_url":"https://github.com/FreeCodeCamp","followers_url":"https://api.github.com/users/FreeCodeCamp/followers","following_url":"https://api.github.com/users/FreeCodeCamp/following{/other_user}","gists_url":"https://api.github.com/users/FreeCodeCamp/gists{/gist_id}","starred_url":"https://api.github.com/users/FreeCodeCamp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FreeCodeCamp/subscriptions","organizations_url":"https://api.github.com/users/FreeCodeCamp/orgs","repos_url":"https://api.github.com/users/FreeCodeCamp/repos","events_url":"https://api.github.com/users/FreeCodeCamp/events{/privacy}","received_events_url":"https://api.github.com/users/FreeCodeCamp/received_events","type":"Organization","site_admin":false},"repo":{"id":45327911,"name":"wiki","full_name":"FreeCodeCamp/wiki","owner":{"login":"FreeCodeCamp","id":9892522,"avatar_url":"https://avatars.githubusercontent.com/u/9892522?v=3","gravatar_id":"","url":"https://api.github.com/users/FreeCodeCamp","html_url":"https://github.com/FreeCodeCamp","followers_url":"https://api.github.com/users/FreeCodeCamp/followers","following_url":"https://api.github.com/users/FreeCodeCamp/following{/other_user}","gists_url":"https://api.github.com/users/FreeCodeCamp/gists{/gist_id}","starred_url":"https://api.github.com/users/FreeCodeCamp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FreeCodeCamp/subscriptions","organizations_url":"https://api.github.com/users/FreeCodeCamp/orgs","repos_url":"https://api.github.com/users/FreeCodeCamp/repos","events_url":"https://api.github.com/users/FreeCodeCamp/events{/privacy}","received_events_url":"https://api.github.com/users/FreeCodeCamp/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/FreeCodeCamp/wiki","description":"Free Code Camp's wiki articles","fork":false,"url":"https://api.github.com/repos/FreeCodeCamp/wiki","forks_url":"https://api.github.com/repos/FreeCodeCamp/wiki/forks","keys_url":"https://api.github.com/repos/FreeCodeCamp/wiki/keys{/key_id}","collaborators_url":"https://api.github.com/repos/FreeCodeCamp/wiki/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/FreeCodeCamp/wiki/teams","hooks_url":"https://api.github.com/repos/FreeCodeCamp/wiki/hooks","issue_events_url":"https://api.github.com/repos/FreeCodeCamp/wiki/issues/events{/number}","events_url":"https://api.github.com/repos/FreeCodeCamp/wiki/events","assignees_url":"https://api.github.com/repos/FreeCodeCamp/wiki/assignees{/user}","branches_url":"https://api.github.com/repos/FreeCodeCamp/wiki/branches{/branch}","tags_url":"https://api.github.com/repos/FreeCodeCamp/wiki/tags","blobs_url":"https://api.github.com/repos/FreeCodeCamp/wiki/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/FreeCodeCamp/wiki/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/FreeCodeCamp/wiki/git/refs{/sha}","trees_url":"https://api.github.com/repos/FreeCodeCamp/wiki/git/trees{/sha}","statuses_url":"https://api.github.com/repos/FreeCodeCamp/wiki/statuses/{sha}","languages_url":"https://api.github.com/repos/FreeCodeCamp/wiki/languages","stargazers_url":"https://api.github.com/repos/FreeCodeCamp/wiki/stargazers","contributors_url":"https://api.github.com/repos/FreeCodeCamp/wiki/contributors","subscribers_url":"https://api.github.com/repos/FreeCodeCamp/wiki/subscribers","subscription_url":"https://api.github.com/repos/FreeCodeCamp/wiki/subscription","commits_url":"https://api.github.com/repos/FreeCodeCamp/wiki/commits{/sha}","git_commits_url":"https://api.github.com/repos/FreeCodeCamp/wiki/git/commits{/sha}","comments_url":"https://api.github.com/repos/FreeCodeCamp/wiki/comments{/number}","issue_comment_url":"https://api.github.com/repos/FreeCodeCamp/wiki/issues/comments{/number}","contents_url":"https://api.github.com/repos/FreeCodeCamp/wiki/contents/{+path}","compare_url":"https://api.github.com/repos/FreeCodeCamp/wiki/compare/{base}...{head}","merges_url":"https://api.github.com/repos/FreeCodeCamp/wiki/merges","archive_url":"https://api.github.com/repos/FreeCodeCamp/wiki/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/FreeCodeCamp/wiki/downloads","issues_url":"https://api.github.com/repos/FreeCodeCamp/wiki/issues{/number}","pulls_url":"https://api.github.com/repos/FreeCodeCamp/wiki/pulls{/number}","milestones_url":"https://api.github.com/repos/FreeCodeCamp/wiki/milestones{/number}","notifications_url":"https://api.github.com/repos/FreeCodeCamp/wiki/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/FreeCodeCamp/wiki/labels{/name}","releases_url":"https://api.github.com/repos/FreeCodeCamp/wiki/releases{/id}","deployments_url":"https://api.github.com/repos/FreeCodeCamp/wiki/deployments","created_at":"2015-11-01T04:14:19Z","updated_at":"2016-05-31T07:11:36Z","pushed_at":"2016-06-01T14:54:48Z","git_url":"git://github.com/FreeCodeCamp/wiki.git","ssh_url":"git@github.com:FreeCodeCamp/wiki.git","clone_url":"https://github.com/FreeCodeCamp/wiki.git","svn_url":"https://github.com/FreeCodeCamp/wiki","homepage":"http://www.freecodecamp.com/wiki","size":429062,"stargazers_count":202,"watchers_count":202,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":309,"mirror_url":null,"open_issues_count":64,"forks":309,"open_issues":64,"watchers":202,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/FreeCodeCamp/wiki/pulls/1074"},"html":{"href":"https://github.com/FreeCodeCamp/wiki/pull/1074"},"issue":{"href":"https://api.github.com/repos/FreeCodeCamp/wiki/issues/1074"},"comments":{"href":"https://api.github.com/repos/FreeCodeCamp/wiki/issues/1074/comments"},"review_comments":{"href":"https://api.github.com/repos/FreeCodeCamp/wiki/pulls/1074/comments"},"review_comment":{"href":"https://api.github.com/repos/FreeCodeCamp/wiki/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/FreeCodeCamp/wiki/pulls/1074/commits"},"statuses":{"href":"https://api.github.com/repos/FreeCodeCamp/wiki/statuses/dbb4c729f3a942c3333d3356098ec3e01d81d0cb"}}}}
{"actor":{"display_login":"atjonathan"}}