silly question. But can i make an array with its name as address of user? For example string[] public 0x7v77wfr349C9864De0119E94c3f8d something like that?


No you can't because variable names can't begin with a number in solidity.

| improve this answer | |

Yes you can, provided you prepend a string (which be alphabetic).

For instance you can have a variable named:




(beware: the first character is not zero, but the letter O.

On the other hand, it is very difficult to find a case where this is truly useful!

| improve this answer | |

If you only have one or two users, then:

string[] public aliceArray;
string[] public bobArray;

But I suspect you are looking for something like:

mapping(address => string[]) everyoneArray;

Every possible user address has a corresponding dynamic array of strings.

You specify elements like:


Hope it helps.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.