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:
- Write a program in C to read multiple string and then print.
- Write a program in C to covert small letter to capital letter.
- Write a program in C to covert capital letter to small letter.
- Write a program in C to print month in word.
- Write a program in C to find the number of characters in given string.
0 Comments