Push
Add a new entry at specific location of vector.
- ܀ Interface
- ️܀ See example
- ↢
INTERFACE
MODULE PURE FUNCTION Push(vec, pos, value) RESULT(ans)
INTEGER(Int8|Int16|Int32|Int64|Real32|Real64), INTENT(IN) :: vec(:)
INTEGER(I4B), INTENT(IN) :: pos
INTEGER(Int8|Int16|Int32|Int64|Real32|Real64), INTENT(IN) :: value
INTEGER(Int8|Int16|Int32|Int64|Real32|Real64) :: ans(SIZE(vec) + 1)
END FUNCTION Push
END INTERFACE
PROGRAM main
use easifemBase
integer(i4b), allocatable :: indx(:), ans(:)
indx = [1,2,3,4,5]
ans = Push(indx, 1, 0)
call Display( ans, "ans= " )
result
ans=
0 1 2 3 4 5
ans = Push(indx, 5, 0)
call Display( ans, "ans= " )
result
ans=
1 2 3 4 0 5
ans = Push(indx, 2, 0)
call Display( ans, "ans= " )
result
ans=
1 0 2 3 4 5
END PROGRAM main