So you are saying
integer*1 n1, n2 ! and
integer(1) n3, n4
Have different meanings or just the
integer(kind=1) n5, n6
Has different meaning ?
Haven't yet looked at algorithms on the internet yet but will try to keep it in mind if do. Another question is for example will I have a problem in the following using 'shared' variable lenb as in the following example . I know I could put
lenb as another parameter in the (....) following ad3n but to save clutter would rather not in general - though
in this example would not be a big deal but in other routines where have many such instances it is much
more convenient NOT to have to put the variables in the list plus having to declare them all integer*1 again etc. it saves
excess writing :
module inc
integer*1 i,i1,i2,i3,ihz,ii,nps
integer*2 lena,lenb
contains
subroutine binomrs(n,id,r)
integer*1 n,i,id,j
j=max(id,n-id)
if(j<=n) then ; r=1
do i=1,n-j
r=r*(n-i+1)/i
enddo
else; r=0
endif ; end
end module inc
use inc
integer*1,allocatable::lisin

),liss

,

nps=4
allocate(lisin(nps))
do ihz=1,4
i=nps+ihz-1
call binomrs(i,ihz,r)
lena=nint(r)
allocate(liss(nps,lena))
lenb=0
i=1; call ad3n(i,ihz,lisin,liss)
deallocate(liss) ; enddo
end
recursive subroutine ad3n(ii,nn,lisin,liss)
use inc,only:lena,lenb,nps
integer*1 i,ii,k,nn,lisin(nps),liss(nps,lena)
if(ii<nps) then
do i=0,nn
lisin(ii)=i ; k=ii+1
call ad3n(k,nn-i,lisin,liss)
enddo ; else
lisin(nps)=nn
lenb=lenb+1
liss

,lenb)=lisin
endif ; end
In the above it gives the correct results.
But reason for asking is that had what i thought was a similar instance of using shared variables with the main
in a recursive subroutine and in the module and it too gave for the most part correct answers but for certain parameters it gave the wrong answer till i had to change it and not share the variables. It is always possible that the compiler just happens to give the correct answers but yet it is not always guaranteed.