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