int i;
int numDomains;
char **inactiveDomains;
numDomains = virConnectNumOfDefinedDomains(conn);
inactiveDomains = malloc(sizeof(char *) * numDomains);
numDomains = virConnectListDomains(conn, inactiveDomains, numDomains);
printf("Inactive domain names:\n");
for (i = 0 ; i < numDomains ; i++) {
printf(" %s\n", inactiveDomains[i]);
free(inactiveDomains[i]);
}
free(inactiveDomains);