Path: utzoo!mnetor!uunet!husc6!cmcl2!brl-adm!adm!V053MF43@ubvmsc.cc.buffalo.EDU From: V053MF43@ubvmsc.cc.buffalo.EDU (Mike Ayers) Newsgroups: comp.lang.c Subject: C pointer problems in VMS. Message-ID: <12464@brl-adm.ARPA> Date: 17 Mar 88 14:29:20 GMT Sender: news@brl-adm.ARPA Lines: 45 I have recently been having some big problems passing pointers in VMS C. Consider the following: char *wr(a) int a; { body } main() { printf(" %s ",wr(4)); } This compiles and links without any problems, but I get a stack dump when I run it. The same is true of the following: main() { char b[12]; b[0]='A'; strcpy(((&b)+1),"rf!"); printf(" %s ",b); } Once again it compiles and links without warning, but dumps the stack upon execution. I checked my trusty K&R (less trusty by the day, it seems), which said that this should be correct. I am working in VMS 4.7 . Under this version we must link to SYS$SHARE:VAXCRTL.EXE/SHARE instead of the default library. Has anyone else had this problem, and if so, what can be done about it? At present I am living in fear of library calls that I thought were legal. Me again . . . Mike Ayers /|___/| / , _ | INTERNET: V053MF43@UBVMS.BITNET or | O O / V053MF43@UBVMS.CC.BUFFALO.EDU / / SNAILNET: 190 Minnesota Ave. |\ / ARF! Buffalo, NY 14214 --- BELLNET : (716)838-3696 U DISCLAIMER: I _AM_ the infinite number of monkeys.