How to calculate length of wide-character string in C

1 Answer

0 votes
// Use wcslen() — to calculate length of wide-character string

#include <stdio.h>
#include <wchar.h>

int main(void)
{
    wchar_t *s = L"c c++";
 
    printf("%i\n", wcslen(s));
  
    return 0;
}

  
/*
run:
  
5

*/

 



answered Jun 22, 2017 by avibootz

Related questions

...