docs icon indicating copy to clipboard operation
docs copied to clipboard

[Edit] C++ Arrays

Open Emanuele-Tirendi opened this issue 1 year ago • 4 comments

Type of Edit (select all that apply)

Clarify unclear content and/or terms, Add new content (definitions, codeblocks, etc.)

Description (optional)

In the subsection "Array indices" of this entry it is described how to initialize an array, how to change initialized elements and how to access initialized elements. It is also pointed out that the size of the array cannot be changed during runtime.

What needs to be added is in my opinion

  • the recommendation to not access uninitialized elements. E.g. if we have int arr[5] = {0, 1, 2}, then the elements at index 3 and 4 are not initialized and one should not access them before they're initialized, because there can be anything stored inside.
  • making the programmer aware of that even if an array arr has length n, you can access and modify with arr[n+1] which leads to undefined behaviour and can e.g. overwrite other variables. This one is especially important since I think that beginners could have some trouble to manage the array length information in their programs which could lead them to use index out of bounds. Since there is not an index out of bounds exception, not knowing this fact could lead them to have hard times debugging their program.

Code of Conduct

  • [X] By submitting this issue, I agree to follow Codecademy Doc's Code of Conduct.

For Maintainers

  • [ ] Labels added
  • [ ] Issue is assigned

Emanuele-Tirendi avatar Feb 13 '24 10:02 Emanuele-Tirendi

I'd like to be assigned to this issue.

Emanuele-Tirendi avatar Feb 13 '24 10:02 Emanuele-Tirendi

Hey, I happen to be familiar with the basics of C++, which may help tackle this issue. Would you like to assign this issue for me?

AverageCodeTechnician avatar Feb 17 '24 16:02 AverageCodeTechnician

Hey, I happen to be familiar with the basics of C++, which may help tackle this issue. Would you like to assign this issue for me?

I'm sorry I've changed my mind. I'm already working on another issue. Happy coding.

AverageCodeTechnician avatar Feb 20 '24 18:02 AverageCodeTechnician

I am interested in taking this issue on.

WorananH avatar Mar 03 '24 00:03 WorananH

@Emanuele-Tirendi I will like to be assigned to this issue as part of my code academy portfolio on GitHub .

leopeq21 avatar Mar 21 '24 16:03 leopeq21

@Emanuele-Tirendi I am interested in being assigned this issue for my GitHub portfolio project.

JamesMasterton avatar Mar 25 '24 13:03 JamesMasterton

@leopeq21 @JamesMasterton I guess I cannot assign it to you. As far as I know I am not allowed to assign issues. I just created this issue and was waiting myself to be assigned to it. Either I misunderstood something about the workflows in codecademy or the responsible people actually forgot to assign someone.

Emanuele-Tirendi avatar Mar 25 '24 16:03 Emanuele-Tirendi

ok, that's fine

JamesMasterton avatar Mar 25 '24 16:03 JamesMasterton

🌸 Thanks for closing this Issue! Please head over to the Docs Forum if you have any questions about Docs, or reply to the thread on Possible Content Discussion to share ideas and collaborate with other contributors, maintainers, or super users to determine good future issues that will help expand Docs!

github-actions[bot] avatar Apr 12 '24 16:04 github-actions[bot]