I wanted to code some simple DNA sequence comparison C source code
Here is my part of code
int main(){
char* seq1 = (char*)malloc(sizeof(char)*10);
char* seq2 = (char*)malloc(sizeof(char)*10);
seq1 = "AAAAATTTTT";
seq2 = "AAAATTTTGG";
/* Compare these two sequences */
free(seq1);
free(seq2);
}
This code gave me error. ( something like heap error ... )
I removed the memory allocation lines and free memory part and then it gave me result without warnings and error.
whats the difference between I allocate memory first , set value and then free the memory and just not to do so?