Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- type
- Row* = object
- id*: uint64
- username*: string
- email*: string
- proc init_row*(): Row =
- result.username = newString(USERNAME_SIZE)
- result.email = newString(EMAIL_SIZE)
- proc new_row*(id: uint64, username, email: string): Row =
- result.id = id
- result.username = newString(USERNAME_SIZE)
- result.username = username
- result.email = newString(EMAIL_SIZE)
- result.email = email
- var r = new_row(1, "aaa", "bbb")
- var r2 = init_row()
- var pt_Row = addr r
- var pt2_Row = addr r2
- #Copy one to the other
- copyMem(pt2_Row, pt_Row, sizeof(r))
- echo $pt2_Row.username
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement