Xref: news2.mv.net comp.os.msdos.djgpp:2424 From: fnunez AT cs DOT uct DOT ac DOT za (Fabian Nunez) Newsgroups: comp.os.msdos.djgpp Subject: Re: How to code Interrupts in C? Date: 3 Apr 1996 06:23:28 GMT Organization: University of Cape Town Lines: 37 Message-ID: <4jt5h0$6p5@groa.uct.ac.za> References: <4ji0s3$t4i AT news DOT nevada DOT edu> <315F1AEF DOT 5A083C32 AT alcyone DOT com> NNTP-Posting-Host: dione.cs.uct.ac.za To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp In <315F1AEF DOT 5A083C32 AT alcyone DOT com> Erik Max Francis writes: >GEORGE GAGHON wrote: >> int w_stuff >> long l_stufftoo >> byte b_stuffalso >> >> w_stuff = *p <---- will this grab a word at location p >> l_stufftoo = *(p+2)<---- will this grab a long ? >> b_stuffalso = *(p+6) <--- and this will grab a byte, right? >No. It depends on what kind of pointer p is. Say that p is declared as a >char *. Then *p (or, equivalently, p[0]) would get the char at p, *(p + 2) >(or p[2]) would get the char at p + 2, and *(p + 6) (p[6]) would get the char >at p + 6. Since the pointer is a char * (or whatever), dereferencing it gives >you a char (or whatever). If you want to dereference to get other values, you >have to explicitly cast it before dereferencing; i.e., *(int *) p. >-- >Erik Max Francis &tSftDotIotE && http://www.alcyone.com/max && max AT alcyone DOT com >San Jose, California, U.S.A. && 37 20 07 N 121 53 38 W && the 4th R is respect >H.3`S,3,P,3$S,#$Q,C`Q,3,P,3$S,#$Q,3`Q,3,P,C$Q,#(Q.#`-"C`- && 1love && folasade >Omnia quia sunt, lumina sunt. && Dominion, GIGO, GOOGOL, Omega, Psi, Strategem >"Out from his breast/his soul went to seek/the doom of the just." -- _Beowulf_ also, don't forget that DJGPP is a 32bit compiler, so data sizes are different: int = 4 bytes = dword short = 2 bytes = word char = 1 byte = byte -- Fabian Nunez, Bsc(hons) student, University of Cape Town email:fnunez AT cs DOT uct DOT ac DOT za web:http//www.cs.uct.ac.za/~fnunez ---------------------------------------------------------------- "k3wl aRe th3 lAmErz, 4 thEy sh4ll RulE!" - from the ElitE Bible