Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Prodentim Probiotics Specially Designed For The Health Of Your Teeth And Gums

Instant Grammar Checker - Correct all grammar errors and enhance your writing

Teach Your Child To Read

Powerful WordPress hosting for WordPress professionals

Disclosure: My content contains affiliate links.

31,167 questions

40,724 answers

573 users

How to get string length with strlen() function in C

3 Answers

0 votes
#include <stdio.h>
#include <string.h>
 
int main(void)
{
    char s[] = "Unreal Engine 4";
 
	printf("%d", (int)strlen(s));
     
    return 0;
}
 
  
/*
    
run:
    
15

*/

 





answered Jan 27, 2016 by avibootz
edited Jan 28, 2016 by avibootz
0 votes
#include <stdio.h>
#include <string.h>
 
int main(void)
{
    char s[] = "Unreal Engine 4";
 
	int n = (int)strlen(s);
	printf("%d", n);
     
    return 0;
}
 
  
/*
    
run:
    
15

*/

 





answered Jan 27, 2016 by avibootz
edited Jan 28, 2016 by avibootz
0 votes
#include <stdio.h>
#include <string.h>
 
int main(void)
{
    char s[] = "Unreal Engine 4";
 
	printf("%u", (unsigned)strlen(s));
     
    return 0;
}
 
  
/*
    
run:
    
15

*/

 





answered Jan 27, 2016 by avibootz
edited Jan 28, 2016 by avibootz

Related questions

1 answer 28 views
28 views asked Dec 18, 2022 by avibootz
2 answers 108 views
1 answer 50 views
50 views asked Sep 20, 2021 by avibootz
...