ethereum(以太坊)(基础)--容易忽略的坑(三)
pragma solidity ^0.4.10;
contract Byte{
bytes [] public T=new bytes[](3);
function setLeng(uint len) public{
T.length=len;
T.push('0x11');
}
//bytes [5] public T1=new bytes[](5);
//Type bytes memory[] memory is not implicitly convertible to
//expected type bytes storage ref[5] storage ref
//bytes [5] public T1 = [1,2,3,4,5];
//Type uint8[5] memory is not implicitly convertible to expected
//type bytes storage ref[5] storage ref
uint [5] public T1=[1,2,3,4,5];
//bytes [2] public T2 = [0x11,0x12];
//uint [] storage T2= new uint[](5);Expected identifier, got 'Storage'
uint [] public T2= new uint[](5);
function setLeng1(uint len) public{
//T1.length=len;//Expression has to be an lvalue
//uint [5] memory T0=[1,2,3,4,5];Type uint8[5] memory is not implicitly convertible to expected type uint256[5] memory
uint [5] memory T1=[uint(1),2,3,4,5];
for (uint i;i<T1.length;i++){
T2[i] = T1[i];
}
}
function getByte() view public returns(bytes){
//return T;
//return bytes(T2);
}
bytes3 public b=0x123344;
byte[3] public b1;
bytes public b2 = new bytes(3);
string public s1="liny";
function f0() public{
for(uint i;i<b.length;i++){
b2.push(b[i]);
}
}
function f1() returns(string){
return string(b2);//"string: \u0000\u0000\u0000\u00123D"
}
function f2() returns(bytes){
return bytes(s1);//bytes: 0x6c696e79
}
}
ethereum(以太坊)(基础)--容易忽略的坑(三)的更多相关文章
- ethereum(以太坊)(基础)--容易忽略的坑(二)
pragma solidity ^0.4.0; contract EMath{ string public _a="lin"; function f() public{ modif ...
- ethereum(以太坊)(基础)--容易忽略的坑(一)
pragma solidity ^0.4.0; contract base{ address public _owner=msg.sender; uint _a; string internal _b ...
- C#以太坊基础入门
在这一部分,我们将使用C#开发一个最简单的.Net控制台应用,来接入以太坊节点,并打印 所连接节点旳版本信息.通过这一部分的学习,你将掌握以下技能: 如何使用节点仿真器 如何在命令行访问以太坊节点 如 ...
- ethereum(以太坊)(一)
从这周开始,开始学习以太坊开发--solidity,开始决定往区块链方向发展,毕竟区块链技术应用广泛.一开始接触solidity开发语言不太习惯,毕竟一直在学习python语法,有很多都不能接受.有难 ...
- ethereum(以太坊)(十二)--应用(二)__投票(基础总和)
编写应用合约之前,先弄清它的逻辑,有助于我们更好的部署合约 pragma solidity ^0.4.21; pragma experimental ABIEncoderV2; contract vo ...
- ethereum(以太坊)(实例)--"安全的远程购买"
pragma solidity ^0.4.10; contract Safebuy{ uint public price; address public seller; address public ...
- ethereum(以太坊)(实例)--"简单的公开竞拍"
说真的,刚开始接触这个竞拍案例--“简单的公开竞拍”,我就抱着简单的心态去查看这个实例,但是自我感觉并不简单.应该是我实力不到家的原因吧!!!233333...不过经过大半天的努力,自己理解完之后,觉 ...
- ethereum(以太坊)(十四)--Delete
pragma solidity ^0.4.10; contract Delete{ /* delete可用于任何变量(除mapping),将其设置成默认值 bytes/string:删除所有元素,其长 ...
- ethereum(以太坊)(十三)--异常处理/元祖
pragma solidity ^0.4.4; contract Students{ uint[] data= new uint[](4); address _owner = msg.sender; ...
随机推荐
- C语言腾讯课堂(一)
腾讯课堂:c语言从零到精通 1. 从第一个例子开始 #include <stdio.h> int main(void) { printf("hello, qin men \n&q ...
- GUID 格式化
1.Guid.NewGuid().ToString("N") 结果为: 38bddf48f43c48588e0d78761eaa1ce6 2.Guid.NewGuid().ToSt ...
- Ubuntu 安装第一步,打开ssh
http://blog.csdn.net/u010447234/article/details/53557795 1.检查是否有ssh在运行 ps -e | grep ssh* 2.安装openssh ...
- Jenkins新建节点,启动方式没有“通过Java Web启动代理”选项怎么办?
在Jenkins中,打开“系统管理”→“管理节点”→“新建节点”页面时,“启动方式”选项没有“通过Java Web启动代理”,怎么办? 打开“系统管理”,进入“全局安全配置”页面. 1. “JNLP代 ...
- SharePoint中遇到Timeout
使用SharePoint时会遇到不止一种的timeout(即超时)错误. 如果遇到了timeout, 该怎么区分呢? 大致上SharePoint可以控制和影响的timeout地方如下: 1. Shar ...
- SharePoint2010 HTTP Error 503. The service is unavailable 解决方法
1.更改系统管理员用户密码前提 因为更改系管理员用户密码会影响到 "SharePoint2010"正常运行,所在尽量不要更改系统管理员用户的密码, 必须更改密码的话,需要注意以两点 ...
- Struts2学习-横切关注点
1.建空项目 2.建包 3.建类 4.编写 package com.nf.action; import com.opensymphony.xwork2.ActionInvocation; import ...
- Oracle SYS用户无法设置session级别的read only
官方文档参考:SYSDBA is used internally in the Oracle database and has specialized functions. Its behavior ...
- 西门子 1500 1200 PLC,位访问, 字节访问
访问byte,word中的位 mybyte.%X1 myword.%X1 访问word/dword中的byte myword.%B0 myword.%B1 myDword.%B0 文中mybyte, ...
- 一个程序猿试用有道云笔记VIP功能体验
熟悉我的朋友应该知道,我有一个微信公众号,叫做"汪子熙", 我会定期在上面推送技术文章. 而我绝大多数技术文章都是在每天上下班的地铁上用手机写的,然后到家后同步到电脑上,进行发表. ...