adsense

Hii, welcome to my site. My name is Om prakash kartik. This blog helps you to learn programming languages concepts.

Write a program in C to find the number of characters in given string using pointer.

 Write a program in C to find the number of characters in given string using pointer.

#include<string.h>
#include<stdio.h>
 void main()
   {
       int l=0;
       char str[30],*p;
       p=str;
       puts("Enter a string.:-");
       gets(str);
       while(*p!='\0')
       {
           p++;
           l++;
       }
      printf("Lenght of string=%d",l);
      getch();
   }


Output:


Related programs:

  1.    Write a program in C to read multiple string and then print.
  2.     Write a program in C to covert small letter to capital letter.
  3.     Write a program in C to covert  capital letter to small letter.
  4.     Write a program in C to print month in word.
  5.     Write a program in C to find the number of characters in given string.

Post a Comment

0 Comments