Dynamically Add Rows in Apex PageBlockTable

Controller:

public class Sample{
    
    Account acc = new Account();
    public List<Account> accList { get; set; }
    
    public Sample()
    {
        accList = new List<Account>();
        accList.add(acc);
    }
    
    Public void addAccount()
    {
        Account ac = new Account();
        accList.add(ac);
    }
}

Visualforce Page:

<apex:page Controller="Sample">
    <apex:form>
        <apex:pageBlock id="pbAcc">
            <apex:pageblockSection >
                <apex:pageBlockTable value="{!accList}" var="acc">
                    <apex:column headerValue="Account Name">
                        <apex:inputField value="{!acc.Name}"/>
                    </apex:column>
                    <apex:column headerValue="Account Number">
                        <apex:inputField value="{!acc.AccountNumber}"/>
                    </apex:column>
                    <apex:column headerValue="Account Type">
                        <apex:inputField value="{!acc.Type}"/>
                    </apex:column>
                    <apex:column headerValue="Industry">
                        <apex:inputField value="{!acc.Industry}"/>
                    </apex:column>
                </apex:pageBlockTable>
                <br/><apex:commandLink value="Add Row" action="{!addAccount}" reRender="pbAcc"/>   
            </apex:pageblockSection>        
            <apex:pageblockSection columns="1" >
                <apex:pageblockSectionItem >
                    <apex:commandButton value="Save" />
                    <apex:commandButton value="Cancel" />
                </apex:pageblockSectionItem>         
            </apex:pageblockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>

Output: