Reversing a string

In reply to janudeep3:

Per the LRM, the length of a string is the size of the string assigned to it. Since you don’t assign anything to s2 when it is declared, it has a size of 0. Trying to store characters to a null string should be an error.

You should first assign s1 to s2 to create a string of the correct size, then do the reverse function.