def errfunc(p, x, y, fitfunc):
    """Error function used in fitting.

    Args:
        p (list): List of parameters.
        x (:class:`numpy.ndarray`): x values.
        fitfunc (function): Fitting function.

    Returns:
        :class:`numpy.ndarray`: Values of residuals.
    """
    return y - fitfunc(p, x)