How to get subcategory of category in WordPress

When you develop WordPress plug-in widget etc you will have to get subcategory of a given category. You can use the following code to get the subcategory

We are going to use get_terms($taxonomies, $args) function. If you want to learn more about this function please have look at the code reference