Search This Blog

Translate

Write C program example to find length of Given String

Write C program to find length of  Given String  using call by reference, Write C program to find length of  Given String  using call by reference with source code, Write C program to find length of  Given String  using pointer with source code,Write C program using function to find length of  Given String  using call by reference

#include<stdio.h>
#include<conio.h>
void len(char *,int *);
void main()
{
 char s[100],*ptr;
 int l,*le;
 le=&l;
 printf("Enter the string :  \t");
 gets(s);
 ptr=s;
 len(ptr,&le);
 printf("length=%d",le);
 getch();
 }
void len(char *a,int *l)
{
int i=0;
 while(*a!='\0')
 {

  i++;
  a++;
 }
 *l=i;

}

C Program example List

Google+ Badge