For large string i am getting segmentation fault

  1. i have used string here and i want to know how to allocate memory for a long string

  2. i am not able to use malloc as we need a pointer but here instead of char array , i have used string ,i want to know how to point to the starting address of a string

Have debugged your code here, Now it’s working fine

String doesn’t need any specific thing for allocation, you canstore as much as you can by appending in a string
You can solve this problem like this also. Consider it too.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

1 Like