I was watching a lecture on finding the string that is the longest out of the given n strings. Sir explained two methods of solving the problem, one by using strcpy function or the other by using a loop. I understood those methods but I thought of another approach. But using that the output is not coming right. Please help me understand what is wrong in my approach. Below is the link to the program.
Copying contents of one string to the other
hello @priyam04
ptr=current; here u are assigning address of current to ptr.
ans sunce address of current is not changing , ptr will have same adress every time.
so when u will print ptr it will print the last string of the input.
make ptr an array and use strcpy function to copy the max leng string