pointers - Modify a char * in C++ -
I am doing a project for school and I have to use str * intead of Strong. I need to revise some parts of four ways, but every time I try to do that I have memory problems.
The format in the name is "1.1.2" and what I have to do is AC back up "1.1.3" so I need to get the last character by name and +1.
This is part of the code:
struct ve {char * name; }; Char * modificar (ve * v) {char * c = new char (strlen (v- & gt; name) +1); // I do not know what I should do here to get the results; }
There is a very basic approach to doing the same way that you mentioned Done:
four * c = strdup (v- & gt; name); C [strlen (c) -1] ++; Return c; However, there are problems for things like 1.1.9, for which a little more complex logic is required.
Comments
Post a Comment