Possible Duplicate:
Why do I get a segmentation fault when writing to a string?
I am writing a very simple program where I am trying to concatenate two string in a for loop. The first string in the string concatenation is fixed and the second string is obtained by using itoa funciton. The program is building up successfully but when I am trying to run the program then it is not able to run and getting stopped. I just debugged the program and while debugging I realized that the program is getting stuck in the string concatenation operation. I am posting the program below. Thanks for all your support : 
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc,char *argv[])
{
    char *str="NULL" ,dec[] = "NULL";
    int i,num;
    printf("Enter a number : \n");
    scanf("%d",&num);
    for (i=0;i<num;i++)
    {   str = "test_file_num_"; 
        itoa(i,dec,10);
        strcat(str,dec);
         printf("%s\n",str);
    }
 return 0;
}
 
     
     
    