int_value
(presumably declared in data section), where sw
is store word:
li $v0, 5 syscall sw $v0, int_value
fgets
.
n
-1 characters into a buffer and terminates the string with a null character.
n
-1 characters are in the current line, it reads up to and including the newline and terminates the string with a null character.
n
additional bytes.
This would be used for dynamic memory allocation.
String Output | String I/O | Integer Output |
---|---|---|
.data s1: .ascii "abc" s2: .asciiz "xyz" .text la $a0, s1 li $v0, 4 syscall |
.data s: .space 4 .text la $a0, s li $a1, 4 li $v0, 8 syscall # Enter "12345". la $a0, s li $v0, 4 syscall |
.data val: .word 0 .text li $v0, 5 syscall # Enter 12345. sw $v0, val la $a0, val li $v0, 1 syscall |
Output | Output | Output |