CHSORT@

Platform

x64, Win32

Purpose

To sort an array of characters.

Syntax

SUBROUTINE CHSORT@(A,CHS,N)
CHARACTER (LEN=*) CHS(N)
INTEGER (KIND=3) A(N),N

Description

CHSORT@ sorts the character array CHS by setting pointers from 1 to N in the array A. After sorting, A(1) contains a pointer to the "first" element of CHS, A(2) to the "second", and so on.

Example

PROGRAM SORT
 CHARACTER (LEN=20)::PUPILS(100)
 INTEGER (KIND=3)::I,IP(100)
 DO I=1,100
  READ(5,'(A)') PUPILS(I)
 END DO
 CALL CHSORT@(IP,PUPILS,100)
 PRINT *,'Sorted list of pupils:-'
 DO I=1,100
  PRINT *,PUPILS(IP(I))
 END DO
END PROGRAM SORT

 

 

Basket
Empty
 
Copyright © 1999-2024 Silverfrost Limited