Hi,
- I have this function which is called about 1000 times from main(). When i initialize a pointer in this function using malloc(), seg fault occurs, possibly because i did not free() it before leaving the function. Now, I tried free()ing the pointer before returning to main, but its of no use, eventually a seg fault occurs.
- The above scenario being one thing, how do i initialize double pointers (*ptr) and pointer to array of pointers (ptr[])?
- Is there a way to copy a string ( which is a char array) into an array of char pointers. char arr[]; (Lets say there are fifty such arrays) char *ptr_arr[50]; Now i want point each such char arr[] in *ptr_arr[] How do i initialize char *ptr_arr[] here?
- What are the effects of uninitialized pointers in C?
- Does strcpy() append the '\0' on its own or do we have to do it manually? How safe is strcpy() compared to strncpy()? Like wise with strcat() and strncat().
Thanks.