0

How to do this program in C?

write a function that accepts a string. then it increase the alphabet of the string by 1(z become a). it than stores the new string in another string and returns that string.

13th Sep 2017, 2:07 PM
Shantanu Shinde
Shantanu Shinde - avatar
6 Antworten
+ 2
Not C++, it is allowed to do : int * a = new int[n]; But not : int a[n];
14th Sep 2017, 6:25 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
+ 2
It would create a rather big problem. It would mean that either compiler add free by itself at the end of the scope, or the stack size can change during the execution (which is impossible)
14th Sep 2017, 6:29 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
+ 1
And as I worked with gcc, I always had errors with it (C90), I do not know for sure for C99
14th Sep 2017, 6:28 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
+ 1
I am curious as of how the compiler do with this case. My guess would be a const pointer deleted at the end of its scope, but I do not know what would happen if the allocation failed
15th Sep 2017, 6:41 AM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
0
ns is not taking any string
14th Sep 2017, 1:19 AM
Shantanu Shinde
Shantanu Shinde - avatar
0
@kurwius char[not constant] is forbidden
14th Sep 2017, 6:30 AM
Baptiste E. Prunier
Baptiste E. Prunier - avatar