Tips needed - How do I match the "{" with "}"

Discussion in 'C Programming' started by 2005, Nov 7, 2006.

  1. 2005

    2005 Guest

    Hi

    How do I match the "{" with "}"
    This is to math the loop begin and end.

    There is a command/short cut (say ALT F5) I used but I forgot.

    Thanks
     
    2005, Nov 7, 2006
    #1
    1. Advertising

  2. 2005 said:

    > Hi
    >
    > How do I match the "{" with "}"
    > This is to math the loop begin and end.


    You press % - which also works for ( ) and [ ] of course.

    (I presume you're using vim, like any sensible C programmer.)

    > There is a command/short cut (say ALT F5) I used but I forgot.


    I dare say you could map ALT F5 to it if you wanted.

    --
    Richard Heathfield
    "Usenet is a strange place" - dmr 29/7/1999
    http://www.cpax.org.uk
    email: rjh at above domain (but drop the www, obviously)
     
    Richard Heathfield, Nov 7, 2006
    #2
    1. Advertising

  3. 2005

    Guest

    if cscope is enabled u can use SHIFT+5 ,

    Caution : before going to use this make some comment and in comment
    add { or }

    for(somecode)
    {

    code
    /*

    some code
    } <--this is commented

    */
    code
    }

    now try to match the { after for.

    this is d point required in mind while you are debugging complex code.


    --raxit
     
    , Nov 7, 2006
    #3
  4. 2005

    Richard Bos Guest

    "2005" <> wrote:

    > How do I match the "{" with "}"
    > This is to math the loop begin and end.


    You use strcspn() or strbrk() to find the '{'s and '}'s, and you use a
    stack construct (either indirectly, through recursion, or directly,
    using, say, a linked list) to determine which '}' belongs to which '{'.
    If you want to know how, the simplest way of figuring out an algorithm
    is, as so often, to sit down behind a piece of paper, copy down a random
    formula with such brackets in it, and observe how you yourself match
    them up.

    > There is a command/short cut (say ALT F5)


    ISO C does not guarantee that you even have Alt or F5 keys, let alone
    that you can read them.

    Richard
     
    Richard Bos, Nov 7, 2006
    #4
  5. "2005" <> writes:
    > How do I match the "{" with "}"
    > This is to math the loop begin and end.
    >
    > There is a command/short cut (say ALT F5) I used but I forgot.


    You're asking about some specific editor (and you haven't told us
    which one), not about the C language.

    --
    Keith Thompson (The_Other_Keith) <http://www.ghoti.net/~kst>
    San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
    We must do something. This is something. Therefore, we must do this.
     
    Keith Thompson, Nov 7, 2006
    #5
  6. 2005

    2005 Guest

    Visual Studio 6 EE: Tips needed - How do I match the "{" with "}"

    Keith Thompson wrote:
    > "2005" <> writes:
    > > How do I match the "{" with "}"
    > > This is to math the loop begin and end.
    > >
    > > There is a command/short cut (say ALT F5) I used but I forgot.

    >
    > You're asking about some specific editor (and you haven't told us
    > which one), not about the C language.


    Sorry, Visual Studio 6 EE.
     
    2005, Nov 7, 2006
    #6
  7. Re: Visual Studio 6 EE: Tips needed - How do I match the "{" with "}"

    In article <>,
    2005 <> wrote:
    >
    >Keith Thompson wrote:
    >> "2005" <> writes:
    >> > How do I match the "{" with "}"
    >> > This is to math the loop begin and end.
    >> >
    >> > There is a command/short cut (say ALT F5) I used but I forgot.

    >>
    >> You're asking about some specific editor (and you haven't told us
    >> which one), not about the C language.

    >
    >Sorry, Visual Studio 6 EE.


    Smackin' the newbies, day after day.
     
    Kenny McCormack, Nov 7, 2006
    #7
  8. 2005

    CBFalconer Guest

    Re: Visual Studio 6 EE: Tips needed - How do I match the "{" with "}"

    2005 wrote:
    > Keith Thompson wrote:
    >> "2005" <> writes:
    >>
    >>> How do I match the "{" with "}"
    >>> This is to math the loop begin and end.
    >>>
    >>> There is a command/short cut (say ALT F5) I used but I forgot.

    >>
    >> You're asking about some specific editor (and you haven't told us
    >> which one), not about the C language.

    >
    > Sorry, Visual Studio 6 EE.


    It's still not about the portable standard C language, which is the
    subject of this newsgroup, and thus is off-topic here. You want a
    group with the words Visual or Microsoft in its name.

    The moment you have to be specific about a compiler, editor,
    linker, etc. it is off topic here.

    --
    Chuck F (cbfalconer at maineline dot net)
    Available for consulting/temporary embedded and systems.
    <http://cbfalconer.home.att.net>
     
    CBFalconer, Nov 7, 2006
    #8
  9. Re: Visual Studio 6 EE: Tips needed - How do I match the "{" with"}"

    "2005" <> writes:
    > Keith Thompson wrote:
    >> "2005" <> writes:
    >> > How do I match the "{" with "}"
    >> > This is to math the loop begin and end.
    >> >
    >> > There is a command/short cut (say ALT F5) I used but I forgot.

    >>
    >> You're asking about some specific editor (and you haven't told us
    >> which one), not about the C language.

    >
    > Sorry, Visual Studio 6 EE.


    Ok, so you'll need to ask in a forum where they discuss Visual Studio
    6 EE.

    --
    Keith Thompson (The_Other_Keith) <http://www.ghoti.net/~kst>
    San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
    We must do something. This is something. Therefore, we must do this.
     
    Keith Thompson, Nov 7, 2006
    #9
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ravi
    Replies:
    0
    Views:
    399
  2. hiwa
    Replies:
    0
    Views:
    653
  3. Victor
    Replies:
    2
    Views:
    661
    Victor
    May 17, 2004
  4. Anton
    Replies:
    4
    Views:
    429
    Gregory A. Beamer
    Sep 21, 2009
  5. Replies:
    1
    Views:
    3,426
    Arne Vajhøj
    Jul 31, 2012
Loading...

Share This Page