I've to read a string of brackets to analyze that. How can I read a string to be inserted in an array generated dynamically?
How can I avoid all characters from reading except for brackets using scanf? [ ] { } ( )
Thank you.
edit: I have to read a series of brackets from keyboard but I don't know the length. So I've to create an array generated dynamically ( this is a requirement ) to contains only the space of the brackets. While I'm reading I want to accepts only brackets and avoid all other characters, is this possibile with scanf with the regex?
Simply check all brackets using
ifcondition. Suppose ifchis the array holding the input string then: