You should actually already have a variable named "category"
pre-assigned by Craft, if you've set up your categories to have URLs in the category settings.
So this simplified code is probably all you need.
{% set subCategories = craft.categories.descendantOf(category) %}
{% if subCategories|length %}
<ul>
{% for category in subCategories %}
<li><a href="{{ category.url }}">{{ category.title }}</a></li>
{% endfor %}
</ul>
{% else %}
{% exit 404 %}
{% endif %}
To have different template code for your sub-category pages you're linking to, I would
put the code above in a partial _partials/mainCategory and include it with the include function.
{% if category.level == 1 %}
{% include '_partials/mainCategory' %}
{% else %}
{% include '_partials/subCategory' %}
{% endif %}