- is input a dynamic pointer variable?
- if yes didn’t we need to make it like char *input=new char[strlen(s)]
What is static *input and how is it working?
what is the differnce between the variable input and output?
input is a character array you can call it string as well
i think you don’t understand static or dynamic array
Local arrays are created on the stack, and have automatic storage duration – you don’t need to manually manage memory, but they get destroyed when the function they’re in ends. They necessarily have a fixed size:
int foo[10];
Arrays created with operator new[] have dynamic storage duration and are stored on the heap (technically the “free store”). They can have any size, but you need to allocate and free them yourself since they’re not part of the stack frame:
int* foo = new int[10];
delete[] foo;
so to return our ans we make dynamic array
i hope this is helful
if you have any other doubt feel free to ask
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.