TestingFrenzy

Ex6.1 C Lab

Nov 26th, 2025
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.25 KB | None | 0 0
  1. int slengthptr(char s[]) {
  2.     int count = 0;
  3.     char *sptr = s; // puntatore char perchΓ¨ s Γ¨ un char
  4.  
  5.     if (sptr == NULL) {
  6.         return -1;
  7.     }
  8.  
  9.     while (*sptr!='\0') {
  10.         count++;
  11.         sptr++;
  12.     }
  13.  
  14.     return count;
  15. }
Advertisement
Add Comment
Please, Sign In to add comment