char *start is const char *start, pointer to const char, u can't derefernce it and change it. take a char start[256].try this.
On Tue, Feb 15, 2011 at 12:31 PM, dinesh bansal <[email protected]> wrote: > Hi All, > > Can you please point me to the error in the following function. It gives > segmentation fault. > > int main() > { > char *start = "12.12.12.12.12976665176069214"; > char *hex_buf = "65003a0a"; > unsigned short i, j = 0; > int new_len2 = strlen(hex_buf); > for (i = 0; ((j+1) < new_len2); i+=2,j+=2) > { > start[i] = hex_buf[j]; > start[i+1] = hex_buf[j+1]; > } > } > > Thanks, > -- > Dinesh Bansal > The Law of Win says, "Let's not do it your way or my way; let's do it the > best way." > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
