User Tools

Site Tools


Sidebar

Programming Reference/Librarys

Question & Answer

Q&A is closed







c:string.h:strlen

strlen

size_t strlen(const char *str);

calculates the size of a char array

C Sourcecode Example

#include <stdio.h>
#include <string.h>
 
int main (void) 
{
 
  char ss[20] = "hello world";
  int length = strlen(ss);
  int i;
 
  printf ("strlen is %i\n", length);
 
  for ( i = 0; i < length ; ++ i )
    printf ("iam at char count %i\n", i);
 
  return 0;    
}
  ===== output =====
  strlen is 11
  iam at char count 0
  iam at char count 1
  iam at char count 2
  iam at char count 3
  ...
  iam at char count 10
advertising
c/string.h/strlen.txt · Last modified: 2014/04/05 05:08 by 188.113.222.212

Impressum Datenschutz