Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sodexx7/43d4b778b94bc46f51ea681c4ac556d7 to your computer and use it in GitHub Desktop.
Save sodexx7/43d4b778b94bc46f51ea681c4ac556d7 to your computer and use it in GitHub Desktop.
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=builtin&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.23;
contract TestArrayInDifferentSituations {
// function testMemory(uint[] memory array,uint[] memory array2) pure external returns (uint[] memory result){
// return array;
// }
// function testCalldata(uint[] calldata array) pure external returns (uint[] memory result){
// return array;
// }
// function testMemory(uint[] memory array) pure external returns (uint[] memory result){
// return array;
// }
function convertStringToBytes(string memory param) external returns(bytes memory result) {
// return abi.encodePac (param);
return abi.encodePacked(param);
}
function testBytes(bytes calldata param) pure external returns (bytes calldata result){
return param;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment