Briefly explain about String Manipulation Using Pointers with example program.


A String is basically an array of characters , terminated with a null character. Thus the way we accessed integer arrays , similarly we can access character arrays.              

#include<stdio.h>

    int main()

    {

    char *name;

    name=”MSPVL”;

    int len;

    printf("%S\n",name);

    char *chptr=name;

    while(*chptr!=0) //check for NULL character

    {

    printf(“%c is stored at address %u\n”,*chptr,chptr);

    chptr++;

    }

    len=chptr-name; //chptr is at end of string

    printf(“\n Length of string = %d \n”,len);

    }

0 Comment "Briefly explain about String Manipulation Using Pointers with example program."

Post a Comment

:) :)) ;(( :-) =)) ;( ;-( :d :-d @-) :p :o :>) (o) [-( :-? (p) :-s (m) 8-) :-t :-b b-( :-# =p~ $-) (b) (f) x-) (k) (h) (c) cheer
Click to see the code!
To insert emoticon you must added at least one space before the code.

Loading...
இணைந்திருங்கள் 24 நேரமும்!! Like us on Facebook!)