Question: Please explain the codes in each line. Pointer lab in C * * * * 67 * In C characters are are terminated by the
Please explain the codes in each line. Pointer lab in C
* * * * 67 * In C characters are are terminated by the null character ('\0') 68 * given a pointer to the start of the string return the length of this string 69 * (The null character is not counted as part of the string length.) 70 * 71 * ALLOWED : 72 * Pointer operators: *, & 73 * Binary integer operators: -, +, *, ==, !=, 74 * Unary integer operators: ! 175 Shorthand operators based on the above: ex. >, ^, /, % 181 * Unary integer operators: ~, 82 83 int stringLength(char * s) { 84 // Your code here 85 86 int length = 0; 87 88 int i; 89 90 for(i =0; *(S+i) !='\0'; i++){ 91 length++; 92 } 93 94 95 return length; 96 }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
