Hi I am facing a fragmentation error while executing this code? Can someone explain why?
- by aks
#include<stdio.h>
struct table
{
char *ipAddress;
char *domainName;
struct table *next;
};
struct table *head = NULL;
void add_rec();
void show_rec();
int main()
{
add_rec();
show_rec();
return 0;
}
void add_rec()
{
struct table * temp = head;
struct table * temp1 = (struct table *)malloc(sizeof(struct…