Skip to content

Instantly share code, notes, and snippets.

@ArslanKathia
Created January 26, 2023 17:28
Show Gist options
  • Save ArslanKathia/c9ce177cd860b134dac55fecebfc5d0b to your computer and use it in GitHub Desktop.
Save ArslanKathia/c9ce177cd860b134dac55fecebfc5d0b 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=soljson-v0.8.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
//SPDX-License-Identifier: MIT
pragma solidity ^0.8;
contract Structure{
//structure are reference type data type which save the address or reference.
struct Employee{
string name;
uint age;
uint salary;
address account;
string designation;
}
Employee public emp;
Employee[] public emp2;
function setValue() public{
Employee memory emp_1 = Employee("Ali",23,40003,msg.sender,"Senior developer");
// Employee memory emp_2 = ({
// name : "John",
// age : 12,
// salary : 3453543,
// account : 0x5B38Da6a701c568545dCfcB03FcB875f56beddC4,
// designation : "Project Manager"
// });
emp.name = 'Arslan';
emp.age = 36;
emp.salary = 40000;
emp.account = msg.sender;
emp.designation = 'Developer';
// delete emp.account;
// emp_1.name = "Ahmad";
emp2.push(emp_1);
emp2.push(emp);
emp2.push(Employee('Chahch',1213,12211221,msg.sender,'Seniro'));
//emp2.push(emp_2);
//emp2.pop();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment