TIP: Click on subject to list as thread! ANSI
echo: aust_c_here
to: Paul Edwards
from: andrew clarke
date: 1996-06-16 09:10:48
subject: Find a word

14 Jun 96 11:32, Paul Edwards wrote to Frank Adam:

 > I can't remember though - does the "const" in strstr() mean that you 
 > aren't changing the data that the pointers point to, or that you aren't
 > changing the pointers themselves?  BFN.  Paul.

The former.  You can modify a const pointer (ie. perform pointer
addition/subtraction), and read the data pointed to by the pointer, just
not write to the data the pointer points to.

int main(void)
{
    char *ptr;
    const char *cptr;

    ptr++;        /* this is legal */
    cptr++;       /* this is legal too */

    *ptr = 'A';   /* this is legal */
    *cptr = 'A';  /* this is not! */

    return 0;
}

--- Msged/2 3.40ac alpha 2
* Origin: Blizzard of Ozz, Melbourne, Australia (3:635/727.4{at}fidonet)
SEEN-BY: 50/99 620/243 623/630 632/349 635/503 544 727 728 711/401 409 410
SEEN-BY: 711/413 430 808 809 932 934 712/515 713/888 714/906 800/1
@PATH: 635/727 544 50/99 711/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™.