Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!rutgers!sri-spam!mordor!lll-tis!ptsfa!ihnp4!homxb!mtuxo!mtune!codas!killer!tad From: tad@killer.UUCP (Tad Marko) Newsgroups: comp.lang.c Subject: Need help with structure pointers Message-ID: <1778@killer.UUCP> Date: Sat, 10-Oct-87 00:39:59 EDT Article-I.D.: killer.1778 Posted: Sat Oct 10 00:39:59 1987 Date-Received: Mon, 12-Oct-87 07:00:28 EDT Organization: The Unix(R) Connection, Dallas, Texas Lines: 40 I've never bothered to get a complete grasp over structures before, and now it is hurting me. Could someone please tell me the proper way to accomplish the following ugliness? ----------------- struct X { char *s; int a, b; }; main() { struct X x; struct X *sp; char max[25]; sp = &x; sp.s = max; strcpy(x.s, "Some Stuff"); fun(&x); } fun(stuff) struct X *stuff; { stuff->*(++s) = 'X'; printf("%s\n", stuff.s); /* I want this to print "Xme Stuff" */ } =============================================================================== Tad Marko at UNIX Connection BBS AT&T 3B2, Dallas, Texas North Texas State University ACM C/UNIX SIG Chairman Snail: UUCP: ihnp4!killer!tad 2829 Sagebrush Drive or ihnp4!convex!ntvax!tad Flower Mound, Texas 75028-2721 BitNet: IG45@NTSUVAX 214-539-0080 214-539-7776 TEXNET: NTVAXB::IG45 "Hi there!" -- Peter Gabriel InterN: IG45%NTVAXB.DECNET@UTADNX.CC.UTEXAS.EDU