0
I need to make a code where I need to transform a string into an int, but the user can type the number like this: [1234], then I need to remove the first and last character so that it is possible to transform the string into int. Can anyone help me? I’ve tried to do it many ways, but nothing’s right
One possibility is to use the function
sscanf
to read a stringx
and ignore the first and last characters of this string and read the integer between them:sscanf(x, "%*c%d%*c", &n);
.– anonimo
Important you [Dit] your question and explain objectively and punctually the difficulty found, accompanied by a [mcve] of the problem and attempt to solve. To better enjoy the site, understand and avoid closures and negativations worth understanding What is the Stack Overflow and read the Stack Overflow Survival Guide (summarized) in Portuguese.
– Bacco