Information

Author(s) Louis Navarre
Deadline No deadline
Submission limit No limitation
Category tags s3, level2, category_string

Tags

Sign in

[S3] Count the '\0'

The character '\0' identifies the end of a string in C. But it can also play the role of a real character.

In this exercice, write the body of the function counting_zero, which counts the number of occurence of the character '\0'.

You cannot use any function from the string library.


Compter le nombre de \0
/*
 * @str: the string to be counted
 * @length: the length of the string, length > 0
 * @return: the number of occurences of '\0'
 *         -1 in case of error
 */
 int counting_zero(char* str, int length){