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

2

2005

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
 
R

Richard Heathfield

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.
 
R

raxitsheth2000

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
 
R

Richard Bos

2005 said:
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
 
K

Keith Thompson

2005 said:
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.
 
C

CBFalconer

2005 said:
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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top