When you get to the end of the key, go back to index 0, this is done by using the remainder of the division by the size of the key (AKA modulus):
for (int j=0, k=0; j < strlen(text); j++, k++)
{
if((text[j] >= 'A') && (text[j] <= 'Z'))
text[j] = ((text[j] -'A') + key[k % size_of_the_key]) % 26 +'A';
if((text[j] >= 'a') && (text[j] <= 'z'))
text[j] = ((text[j] -'a') + key[k % size_of_the_key]) % 26 +'a';
printf("%c", text[j]);
}