Pages

Lenght of string by evaluating the element in the character array one by one. And use of strlen() function

Friday, 19 April 2013


#include <stdio.h>
#include <conio.h>
#include <string.h>
int main()
{
      int i;
      char ch;
      char str[]="This is my 1st assignment of 2nd smester.";
      i=0;
      while(ch!='.')
      {
                    ch=str[i];
                    i++;          
      }
      printf("size of array by eveluating: %d\n", i);
      printf("size of array by Function: %d\n", strlen(str));
      getch();
}

 

Search Box

Most Reading

Contact Form

Name

Email *

Message *