User Tools

Site Tools


Sidebar

Programming Reference/Librarys

Question & Answer

Q&A is closed







c:string.h:strlen

This is an old revision of the document!


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[40] = "hello world";
int length = strlen(ss);
int i = 0;
   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.1358888560.txt · Last modified: 2014/04/05 05:08 (external edit)

Impressum Datenschutz