X-Authentication-Warning: anthony.siemens.ebp.ii3.b-rail.be: ddemerre owned process doing -bs Date: Mon, 2 Jul 2001 13:38:07 +0200 (CEST) From: Dieter Demerre X-Sender: To: Subject: Re: (No Subject) In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On Mon, 2 Jul 2001, poojitha s sajja wrote: > Can anyone please tell me How can I pass a pointer of structure type, > from say prog1.c to prog2.c you make a .h header file defining the pointer as extern, which you then include within your .c file thus making it accessable. e.g. within prog1.h ============== typedef struct { int i; char* j; } T_example_S; typedef T_example_S* T_example_P; extern T_example_P p; /*-----------------------------------------*/ within prog1.c ============== T_example_P p; void function1(void) { p->i = 12; } /*-----------------------------------------*/ within prog2.c ============== #include "prog1.h" void function2(void) { switch (p->i) { case 12: p->j = "Function 1 was already called.\n"; break; default: p->j = "peulengaleis rules.\n"; break; } } /*-----------------------------------------*/ Good Luck !!! -- Groetjes vanwege... Greetings from... -- -- Dieter Demerre *** ddemerre AT acm DOT org -- -- http://www.angelfire.com/de/ddemerre/ -- -----BEGIN GEEK CODE BLOCK----- Version: 3.12 GCS/d- s+:++ a-()>-- C+ UH P++(+) L++ E W++ N+ o K? w o V M PS+ PE- Y+ PGP+ t 5? X+ R+> tv+ b+ DI D G e+++ h+> r% z- ------END GEEK CODE BLOCK------