I have the following code:
struct argument {
    char *source;
    char *destination;
    int value;
};
int main(void){
    struct argument *arg2 = malloc(sizeof(struct argument));
    strcpy(arg2->source, "a1"); //This gives segmentation fault.
    strcpy(arg2->destination, "a2");
    arg2->value = 1500;
    return 0;
}
The problem is that when i use strcpy with arg2->destination, everything runs fine, but as soon as I uncomment the strcpy with arg2->source, I immediately get a segmentation fault. What is wrong? Is there a way to fix this?
 
     
    