NEWTON
Asked
6 months ago
10
views
0
I have an array in Cairo
let (myArr : felt*) = alloc()
How do I set the 1st and 2nd term and get the first and second term?
ㅤ This question was originally posted on Triality
0
You can set the terms of the felt* to 1 and 3 respectively like this:
assert [myArr] = 1
assert [myArr + 1] = 3
Then if you want to access the first term, then the second, you would have the following instructions
let val1 = [myArr] # = 1
let val2 = [myArr + 1] # = 3
ㅤ This answer was originally posted on Triality
answered
6 months ago
Cairo: How do I initialize an array in cairo
Cairo: How do I iterate through an array of structs?
How to write "and" conditional logic in Cairo?
Getting the CLASS_HASH of a contract in Cairo
How can i learn Cairo with Python base?
Cairo: What is the difference between let and tempvar?
How can I use dynamic allocation in Cairo?
How to generate a proof for a Cairo program and verify it?[StackOverflow]
What are function argument types in starknet.js?
How can I interact with my contract on Starknet using starknetjs?
How to create Structs in Cairo Lang for StarkNet?
Is uint256 math operators like uint256_le safe? Why do I need to use uint256_check?
How do I transform data from javascript to Cairo?
How can I get ETH for the test net in StarkNet?