```python
def char_frequency(str1):
    """
    Counts the frequency of each character in a given string.

    Args:
        str1: The input string.

    Returns:
        A dictionary where keys are characters and values are their frequencies.
    """
    freq_dict = {}
    for char in str1:
        freq_dict[char] = freq_dict.get(char, 0) + 1
    return freq_dict
```