Posts

Showing posts from March, 2022

Dynamic Array in Solidity

  // SPDX-License-Identifier:GPL-3.0 pragma solidity   0.8.0 ; contract local {     uint [] public kar ;     function pushelement ( uint item ) public     {         kar . push ( item );     }     function popElement () public     {         kar . pop ();     }     function lengthOfArray () public view returns ( uint )     {         return kar . length ;     } }

Fixed array in Solidity

// SPDX-License-Identifier:GPL-3.0 pragma solidity   0.8.0 ; contract local {     uint8 public count = 255 ;     uint [ 5 ] public kar =[ 10 , 50 , 60 , 40 , 85 ];     function length () public view returns ( uint )     {         return kar . length ;     } }