pragma solidity ^0.4.0;

contract EMath{

    string public _a="lin";

    function f() public{
modify(_a);
} //function modify(string storage name) private{
function modify(string memory name) private{
//string storage c = name;Type string memory is not implicitly convertible to expected type string storage pointer
var c = name;
bytes(c)[0] ='L';
} //uint8 ~ uint256
//0000 0000 ~ 1111 1111
//0 ~255
//int8 ~ int256
//1111 1111 ~ 0111 1111
//-127 + 127 +0 =255 uint8 a=3;
//0000 0011
uint8 b=6;
//0000 0110
function yihuo() view returns(uint){
return a ^ b;
/*
0000 0011
0000 0110
0000 0101
*/
} function yifeihuo() view public returns(uint16){
return ~(a ^ (~b));
/*
0000 0011 0000 0110
1111 1001 1111 1010
*/
} function huo() returns(uint){
return a | b;
/*
0000 0011
0000 0110 0000 0111
*/
} function yu() returns(uint){
return a & b;
/*
0000 0011
0000 0110 0000 0010
*/
}
function left() returns(uint8){
return a<<2;
/*
0000 0011 0000 1100
*/
} enum Cants{left,right,mid} Cants public def=Cants.left; function re(Cants c1) returns(bool){
if (def ==c1){
return true;
}
} struct fun{
uint _id;
string _name;
uint _sex;
} //0x14723a09acff6d2a60dcdf7aa4aff308fddc160c
//0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db fun n1=fun(0,'eilinge',1);
fun n2=fun(1,'lin',0); fun[] public funs;
fun[] public funids; function p1() public{
funs.push(n1);
funs.push(n2);
} uint funid;
mapping(address=> fun) addfun; function p2(address na1) public{
fun memory f1 =addfun[na1];
//f1(2,'eil',0);type is not callable
f1._id=2;
}
} contract Addr{
address _owner =0xca35b7d915458ef540ade6068dfe2f44e8fa733c;
uint160 _c = 1154414090619811796818182302139415280051214250812;
/*
0x ca35b7d915458ef540ade6068dfe2f44e8fa733c :.legnth=40
c a
0b 1100 1010 :.length=40*4=uint160
*/
function f1() constant returns(uint160){
return uint160(_owner);
} function f2() constant returns(address){
return address(_c);
} function getBalance(address add) payable returns(bool){
//return add.balance;
add.transfer(msg.value);//msg.sender => add
} bytes1 _a=0xf0;
//0010 0010; 1*8
bytes32 public _b=0x231231;
//32*8 function getLeng() returns(bytes1){
//return _b.length;
return _a[0];
}
function getLeng1() {
//_b.length =5;Expression has to be an lvalue
} string public _d='lilianjie';
//bytes public _f =new bytes;type function (uint256) pure returns (bytes memory)
//is not implicitly convertible to expected type bytes storage ref
bytes public _f =new bytes(2); function bytestring() constant returns(bytes){
return bytes(_d);
}
function stringbytes() constant returns(string){
return string(_f);
}
function modifybytes() public{
//_d.length=5;
//Member "length" not found or not visible after argument-dependent lookup in string storage ref
bytes(_d).length=5;
_f.length=3;
//_d[0]='E';Member "length" not found or not visible after argument-dependent lookup in string storage ref bytes(_d)[0]="L";
}
}

ethereum(以太坊)(基础)--容易忽略的坑(二)的更多相关文章

  1. ethereum(以太坊)(基础)--容易忽略的坑(三)

    pragma solidity ^0.4.10; contract Byte{ bytes [] public T=new bytes[](3); function setLeng(uint len) ...

  2. ethereum(以太坊)(基础)--容易忽略的坑(一)

    pragma solidity ^0.4.0; contract base{ address public _owner=msg.sender; uint _a; string internal _b ...

  3. C#以太坊基础入门

    在这一部分,我们将使用C#开发一个最简单的.Net控制台应用,来接入以太坊节点,并打印 所连接节点旳版本信息.通过这一部分的学习,你将掌握以下技能: 如何使用节点仿真器 如何在命令行访问以太坊节点 如 ...

  4. ethereum(以太坊)(一)

    从这周开始,开始学习以太坊开发--solidity,开始决定往区块链方向发展,毕竟区块链技术应用广泛.一开始接触solidity开发语言不太习惯,毕竟一直在学习python语法,有很多都不能接受.有难 ...

  5. c#实战开发:以太坊钱包对接私链 (二)

    上一篇讲了 以太坊私链搭建 首先下载Ethereum Wallet 钱包 可以直接百度 下载如果直接打开它会默认连接公链 所以我们要通过命令打开 "F:\Program Files\Ethe ...

  6. 以太坊 layer2: optimism 源码学习(二) 提现原理

    作者:林冠宏 / 指尖下的幽灵.转载者,请: 务必标明出处. 掘金:https://juejin.im/user/1785262612681997 博客:http://www.cnblogs.com/ ...

  7. ethereum(以太坊)(十二)--应用(二)__投票(基础总和)

    编写应用合约之前,先弄清它的逻辑,有助于我们更好的部署合约 pragma solidity ^0.4.21; pragma experimental ABIEncoderV2; contract vo ...

  8. ethereum(以太坊)(实例)--"安全的远程购买"

    pragma solidity ^0.4.10; contract Safebuy{ uint public price; address public seller; address public ...

  9. ethereum(以太坊)(实例)--"简单的公开竞拍"

    说真的,刚开始接触这个竞拍案例--“简单的公开竞拍”,我就抱着简单的心态去查看这个实例,但是自我感觉并不简单.应该是我实力不到家的原因吧!!!233333...不过经过大半天的努力,自己理解完之后,觉 ...

随机推荐

  1. Git 基本知识与常用指令

    一.Git代码状态转换图 其中: 未被Git跟踪的状态为unstage状态: 已被Git跟踪的状态为stage状态(stage:阶段),因此包括staging状态和staged状态. untrack ...

  2. spark学习地址

    http://blog.sina.com.cn/s/blog_64d9a6ef0101ghvs.html http://blog.sina.com.cn/s/blog_49cd89710102v3b1 ...

  3. Siebel计划和实施

    1.计划: 自上而下计划配置项目 1)首先,确定UI和应用产品功能 2)然后,确定为实现UI功能而需要在业务层所做的更改 3)最后,确定为实现业务层更改而需要在数据层所做的更改---尽可能少做更改 如 ...

  4. 爬虫入门之jsonPath PhantomJS与 selenium详解(六)

    1 jsonPath数据格式 pip安装: pip install jsonpath 用来解析json格式的字符串,类似于xpath (1) json对象的转换 json.loads() json.d ...

  5. Spring3+Struts2+Hibernate4+Mybatis整合的一个maven例子

    说明: 1.用了maven去搞这个demo,懒得去导jar包... 2.这个demo用了spring去做Ioc,事务的aop:用了struts2去做“MVC”(没有用到任何UI技术,有点对不起这个MV ...

  6. Centos6.5(Linux)安装Nginx

    1.安装nginx依赖的库pcre       下载地址:http://sourceforge.net/projects/pcre/    2.解压pcre        zip解压方式:unzip ...

  7. winform 实现彩票功能

    版权声明:本文为博主原创文章.未经博主同意不得转载. https://blog.csdn.net/MrTraum/article/details/32702319 watermark/2/text/a ...

  8. GroundPlaneEstimator.cpp解读

    GroundPlaneEstimator域下的compute函数,就相当于整个cpp的主函数,也体现了整个调用过程,先执行compute_v_disparity_data,再compute_v_dis ...

  9. Android学习笔记_28_手势识别

    一.准备手势库: 使用SDK自带例子GestureBuilder建立手势库(位置:android-sdk-windows\samples\android-10\GestureBuilder).使用Ge ...

  10. kinect v2

    http://www.tuicool.com/articles/NbmyyeU https://channel9.msdn.com/Blogs/raw-tech/Making-your-body-th ...