codedamn

Dynamic (byte ) Size Array

Created by Kshitij about a year ago

0

No description provided

13 Comments

    0

    I did the Dynamic Size Array Exercise , My code is running perfefctly and performing all the functions in remix but when I run it on your IDE and exercise only 1 test case passes what is wrong ? , please see my code

    @tanmay28

    Tanmay

    @tanmay28

    0

    function get(uint _idx)public view returns(uint){ return id[_idx]; }

    to avoid using the loop you can simply do this

    @dumtoimoh0506

    Dumto Imoh

    @dumtoimoh0506

    0

    Facing the same issue as Tanmay,for the same Lab Here is my code:-

    // SPDX-License-Identifier: MIT pragma solidity >=0.5.0 < 0.9.0;

    contract DynamicArray { uint256[] public arr; function Insert(uint256 input)public { arr.push(input); } function get(uint256 index)public view returns(uint256){ return arr[index]; } function getAll()public view returns(uint256[] memory){ return arr; } function length()public view returns(uint256){ return arr.length; } }

    @ak3113

    Arpith Kumar

    @ak3113

    0

    I'm unable to solve the 59. Dynamic Array exercise using the knowledge provided till this point.

    @abhisekp

    Abhisek Pattnaik

    @abhisekp

    0

    why cant we pass parameters to pushElement function to set value to dynamic Byte array.

    @ganeshrmane99

    Ganesh Mane

    @ganeshrmane99

    0

    help me with this

    //SPDX-License-Identifier:UNLICENSED" pragma solidity >=0.5.0 < 0.9.0;

    contract bytearry{ // fixed size bytes1 public b1; bytes2 public b2; bytes5 public b3; bytes public b4="p"; function setter() public{ b1="a"; b2="ab"; b3="1245"; } function getElement(uint index) public view returns(bytes1){ return b4[index]; } function insertdynamic(bytes1 n) public{ b4.push(n);

    }
    

    }

    @paras004

    Paras Joshi

    @paras004

    0

    // SPDX-License-Identifier: MIT pragma solidity >=0.5.0 < 0.9.0;

    contract DynamicArray{ uint[] public id; function insert(uint a)public { id.push(a); } function get(uint256 a)public returns(uint256){ // uint256 i; for(uint256 i=0;i<id.length;i++){ if(a==id[i]){ return i; } } } function getall() public view returns(uint[] memory){ return id; } function length() public view returns(uint){ return id.length; } }

    //exercise 61 , this code is not working can you help me

    @felixjosep0198

    Felix Joseph

    @felixjosep0198

    0

    Is there a way to pop() elements from a dynamic(byte) size array?

    0

    In the lessons 61 - Dynamic Array, how the solution comes to be a fixed uint256[] array? Is not supposed to be an excerise for dynamics arrays? Am I missing something?

    0

    am missing something, in the return length ( function getLen()public view returns(uint){ return str.length; } )

    why are we using uint instead of bytes?

    @abdulmuizz0190

    Abdulmuizz

    @abdulmuizz0190

    0

    also im finding it hard to set an element in my code;- function set(uint index, uint element) public { str[index]=element;

    @abdulmuizz0190

    Abdulmuizz

    @abdulmuizz0190

    0

    im not able to see the questions reply which were ask by the people

    @saksha62ac3f2b

    saksham kanojia

    @saksha62ac3f2b

    0

    it shows me are you connected error in red colour

    @saksha62ac3f2b

    saksham kanojia

    @saksha62ac3f2b

Your comment