{"action":"closed","issue":{"url":"https://api.github.com/repos/uwhpsc-2016/lectures/issues/5","repository_url":"https://api.github.com/repos/uwhpsc-2016/lectures","labels_url":"https://api.github.com/repos/uwhpsc-2016/lectures/issues/5/labels{/name}","comments_url":"https://api.github.com/repos/uwhpsc-2016/lectures/issues/5/comments","events_url":"https://api.github.com/repos/uwhpsc-2016/lectures/issues/5/events","html_url":"https://github.com/uwhpsc-2016/lectures/issues/5","id":148552354,"number":5,"title":"Allocate Array on the Stack with Length Determined at Run-Time","user":{"login":"alyfarahat","id":18155486,"avatar_url":"https://avatars.githubusercontent.com/u/18155486?v=3","gravatar_id":"","url":"https://api.github.com/users/alyfarahat","html_url":"https://github.com/alyfarahat","followers_url":"https://api.github.com/users/alyfarahat/followers","following_url":"https://api.github.com/users/alyfarahat/following{/other_user}","gists_url":"https://api.github.com/users/alyfarahat/gists{/gist_id}","starred_url":"https://api.github.com/users/alyfarahat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alyfarahat/subscriptions","organizations_url":"https://api.github.com/users/alyfarahat/orgs","repos_url":"https://api.github.com/users/alyfarahat/repos","events_url":"https://api.github.com/users/alyfarahat/events{/privacy}","received_events_url":"https://api.github.com/users/alyfarahat/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/uwhpsc-2016/lectures/labels/Answered","name":"Answered","color":"c2e0c6"},{"url":"https://api.github.com/repos/uwhpsc-2016/lectures/labels/Great%20Question!","name":"Great Question!","color":"e99695"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":11,"created_at":"2016-04-15T04:31:02Z","updated_at":"2016-04-15T23:28:16Z","closed_at":"2016-04-15T23:28:16Z","body":"One of the things I was surprised to know from today's lecture is that it is allowed to allocate an array on the stack with length determined at run-time. For example,\r\n```C++\r\nvoid foo(int length)\r\n{\r\n    int arr[length];\r\n    populate_range(arr, length);\r\n    return;\r\n}\r\n```\r\nNow what would be a use-case where dynamic allocation is the only way to go? Is it a situation where we need dynamic-length arrays that are persistent across multiple threads of execution, for example?"}}