Skip to content

How many tokens would an array take up? #123

Closed Answered by SebLague
Georgej100 asked this question in Q&A
Discussion options

You must be logged in to vote

If you write int[] array = { 1, 2, 3 }; for example it will count as 9 tokens. The breakdown of counted tokens is:
IntKeyword int
OpenBracketToken [
OmittedArraySizeExpressionToken (hmm I should maybe remove this one, I didn't notice this before)
IdentifierToken array
EqualsToken =
OpenBraceToken {
NumericLiteralToken 1
NumericLiteralToken 2
NumericLiteralToken 3

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by Georgej100
Comment options

You must be logged in to vote
1 reply
@Georgej100
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants