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

on the occasion of the current invasion of Russia in Ukraine

Russian Stop this War
c/string.h/strlen.txt · Last modified: 2024/02/16 01:06 (external edit)

Impressum Datenschutz