I am doing a project for my computer science one course and I am having trouble trying to get the exact size of an array that contains char values. First off the program prompts the user to enter the char values, by using the line `cin.getline(array,100);` Afterwards, it takes the array and then passes it a getSize function that is suppose to return the actual size of the array. The only problem is that it is not inconsistent. Sometimes it returns the right value, but other times it doesn't. 
getSize function : 

```
int getSize(char arr[]){
    int i = 0;  
    for(i; '\0' != arr[i];i++){ 
    }
    return i;
}

```

Example: 
arr[100] contains 5 characters and the rest are null, but the function returns 7 when the program runs. I am not sure if this is an issue, but the program modifies the array before sending it to the size function. It removes the duplicates.