from typing import Optional


def create_constant(name: str, value: Optional[int], should_add_newline: bool = True) -> str:
    """
    Creates at C constant with the given name and optional value.
    """
    if value is None:
        const = '#define {0}'.format(name)
    else:
        const = '#define {0} {1}'.format(name, value)

    if should_add_newline:
        return const + '\n'
    return const