1

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

0

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

| improve this answer | |
0

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

For instance you can have a variable named:

ACC0x7v77wfr349C9864De0119E94c3f8d

or

Ox7v77wfr349C9864De0119E94c3f8d

(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 | |
0

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:

everyoneArray[<address>][<row>];

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.