Thread: How to remove text within parentheses in C ?

  1. #1
    Registered User
    Join Date
    Aug 2018
    Posts
    1

    Question How to remove text within parentheses in C ?

    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?

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    37,316
    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.
    Code:
    while ( (ch=getc()) != EOF ) {
      if ( ch == '[' )
        printf("Found opening [\n");
    }
    Make sure you can do that reliably before doing anything else.




    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 07-23-2011, 10:26 PM
  2. Remove a specific char and remove multiple spaces
    By stam in forum C++ Programming
    Replies: 9
    Last Post: 12-18-2010, 07:50 AM
  3. How to remove text/format leaders VS 2005
    By csonx_p in forum Tech Board
    Replies: 4
    Last Post: 05-16-2008, 04:21 AM
  4. Remove data from text file
    By beon in forum C++ Programming
    Replies: 2
    Last Post: 05-17-2007, 08:53 PM
  5. Remove text from external file....
    By Unregistered in forum C++ Programming
    Replies: 3
    Last Post: 03-18-2002, 05:49 PM

Tags for this Thread