Hello everyone, I am beginner of C and I need a program to remove the text within parentheses.
For example :
Input : [0.12] Hello <int>
Output : Hello
Anyone can give me an example how to run this program?
Hello everyone, I am beginner of C and I need a program to remove the text within parentheses.
For example :
Input : [0.12] Hello <int>
Output : Hello
Anyone can give me an example how to run this program?
So what are your thoughts on how this might be achieved?
Think about the steps involved, break the problem down into manageable steps.
A development process
Do you have to deal with nested constructs like this?
[0.12(345)] Hello <int>
Do you have to deal with errors like mis-matches?
[0.12[345] Hello <int>
I would suggest you write a program which at least detects your parenthesis chars.
Make sure you can do that reliably before doing anything else.Code:while ( (ch=getc()) != EOF ) { if ( ch == '[' ) printf("Found opening [\n"); }
We work with you, not for you.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.