| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | indirection |
Paul Edwards wrote at Frank Adam: FA>Paul, i am shocked ! Pointers can't be multiplied !? PE>I wasn't actually aware that they couldn't be multiplied. There's no reason for multiplying pointers, since they're just memory addresses. PE>I am used to pointers being integers, and knowing how C likes to PE>let you do anything, I would have thought you could do something PE>like that! You'd have to cast to integers I guess, with something like: p3=(void*)((int)p1*(int)p2); PE>Come to think of it, I think I remember something about pointers PE>not being allowed to be divided either. But there is certainly PE>a reason to want to do that. PE>E.g. PE>char *start; PE>char *end; PE>char *middle; PE>middle = (start + end) / 2; This gives the error "invalid operands to binary +" with GCC; apparently the addition is causing the error because adding pointers has no meaning. The only arithmetic operation which can operate on two pointers with meaning is subtraction because it gives the amount of memory between the pointers. --- FMailX 1.02* Origin: Power BBS - +61-2-858-4114 - Files/Games/EchoMail/Internet (3:711/953) SEEN-BY: 50/99 620/243 623/630 711/401 409 410 413 430 808 809 932 934 946 SEEN-BY: 711/953 963 712/515 713/888 714/906 800/1 @PATH: 711/953 410 808 934 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.