Write a program using pointers to determine the length of a character string.

program:

main()

{
char*name;

int length;

name=”delhi”;

printf(“%s\n”,name);

while(*cptr != ‘\0’)
{
printf(“%c is stored at address %d\n”,*cptr,cptr);
cptr++;
}
length=cptr-name;

printf(“\n length of the string =%d\n”,lenth);
}          

0 Comment "Write a program using pointers to determine the length of a character string."

Post a Comment