char *name = NULL;
cin >> name;
This is the problem. You try to store the input to a NULL memory slot. You need to allocate memory for the variables "name", "link" and "desc" in order to store the input.
The correct way of allocating memory (static memory) on the stack would be:
cout << "enter a string";
cin >> str;
This creates a char array of 16 chars (starting from 0). However, this will become a problem later on since it will become a dangling pointer when you string-copy the variables (in your constructor).
To fix that, you need to first allocate the memory needed on the heap
(dynamic memory) using malloc.
An example of that would be:
char *name = (char *)malloc(sizeof(char)*100+1);
char *link = (char *)malloc(sizeof(char)*100+1);
char *desc = (char *)malloc(sizeof(char)*100+1);
This will allocate memory for a 101 bytes. Since 1 char is 1 byte, you need 100 bytes to store a 100 byte string. This will allow you to store a string consisting of 100 chars.
Note that when you ask for user input, an extra invisible char will be added to the output string which is called the null terminator (which marks the end of a string) and has the size of 1 char.
You need to allocate memory for that null terminator as well, which results in allocating memory for an extra char, aka 101 chars. If you are unsure, just allocate more memory than necessary.
Now that you have allocated your memory on the heap, you can just dereference the pointer instead of using strcpy in your class "Web". This means that you can just point the memory that you have allocated for the variable "name" in the main() function to the variable "name" in your class "Web".
However, for the next iteration, you will overwrite the data since you haven't allocated more memory for the new input. You need to allocate memory in every iteration instead (or on the stack at first, and store it in the heap in the constructor)
You can worry about freeing memory later on once you understand how the stack/heap works and once you've figured out how pointers work. :)
So basically I needed to allocate the size of the actual string I'm going to receive as input from the user on each variable ( name,link,desc ) right?
Should I do this on every iteration of the for loop or lets say I decide on the maximum size once and that's it?
I don't mind override the data stored in those variables as I'm going to store them in the class called Web and using the function setWeb(); to allocate the memory.
but if I need to allocate the memory for each variable in main, shouldn't I do the same in the function aswell?