Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Function Problem

Status
Not open for further replies.

SmallProgram

Programmer
Feb 6, 2002
42
0
0
IN
Iam using a Function call which takes arguments,from a Program. When Iam sending the arguments the arguments are overlapping on Each other.

This is the problem.

Function call :

Character*22 abc(E,F,G,H)

charcter*6 E
charcter*4 F
Integer*2 H
charcter*2 G

Iam Calling the Function like this

abc("Mall","ika",23,"PS")

When Iam Examining the Variables E,F,G,H Iam getting these values.

E : Mallik
F : ikaP
G : 23
H : PS

Whereas I want

E: "Mall"
F: "ika"
G: 23
H: PS

Iam using Fortran77 in VMS Environment.

Can somebody Resolve this issue
 
Let's count characters in "Mill". It's a character*4 string. But function abc waits 6 characters in E (and you can see 6 characters in E parm, 4 in F with garbage P;).
Fortran passes these parameters by reference (address of).

Never disappoint good old F77 hopes: it can't verify your function signatures...
 
Thank you ArkM.

But I know the problem with F77. Can any body suggest me a better solution.

Programmer,Amatuer
 
An idea to include a DATA- statement (?) :
DATA E/' '/,F/' '/,G/' '/
 
If you are using Fortran 9x, then it does not matter whether you use quotes (") or apostrophes (') as long as you are consistent for each string. That is, I could use:

mystring = 'my stuff'
Or
mystring = "my stuff"

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top