I am creating a To-Do list with the limitation that one address should only be able to add upto 100 notes. Below is the snippet of code
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.16;
contract todo
{
struct llist
{
uint no ; // note no.
string cont ; // content
address own ; // owner address
bool iscom ; // completed or not
uint ttim ; // time of creation
}
uint public i ;
mapping ( address => uint) public num ; // for serial no. of note
mapping ( address => llist[]) public num2 ; // creating an array of 100 elements of struct type
function real( string memory _contect) public
{
if ( num[msg.sender] > 99)
i = 8 ;
else
{num2[msg.sender].push( num[msg.sender] , _contect,payable(msg.sender),false,block.timestamp); // Line 1
num[msg.sender]++ ;
}
}
}
I used push opeartion to feed the data into the array of struct present at that address. Still I am getting below error
Can anyone please tell me what I am doing wrong here ?