Path: utzoo!attcan!uunet!ncrlnk!ncrcae!hubcap!gatech!ncar!tank!mimsy!sjr From: sjr@mimsy.UUCP (Stephen J. Roznowski) Newsgroups: comp.lang.c Subject: Passing types to a subroutine Message-ID: <14457@mimsy.UUCP> Date: 10 Nov 88 01:26:15 GMT Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 50 I'm in the process of developing a piece of code that needs to be portable across several different machines. What I need to do is something of the following: main() { ... float a[100]; subroutine(...., a[100], ...); } AND main() { ... double a[100]; subroutine(...., a[100], ...); } and have the subroutine do the right thing with a[]. Eventually, the subroutine needs to so something like: subroutine(....,array,....) [???] *array; { unsign int i; int scale; float bias; ... array[20] = (cast ???) i * scale + bias; } How do you pass the knowledge of the array type to the subroutine? I need to be able to pass the knowledge that the array a[] is either float or double (or for that matter unsign int). Any help will be greatly appreciated. Stephen J. Roznowski sjr@mimsy.umd.edu -- Stephen J. Roznowski sjr@mimsy.umd.edu