📄 node170.htm
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//FR">
<!--Converted with LaTeX2HTML 97.1 (release) (July 13th, 1997)
by Nikos Drakos (nikos@cbl.leeds.ac.uk), CBLU, University of Leeds
* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan
* with significant contributions from:
Jens Lippman, Marek Rouchal, Martin Wilck and others -->
<HTML><BLOCKQUOTE><img src="logo.gif" tppabs="http://www.linux-kheops.com/doc/ansi-c/icons.gif/logo.gif" ALIGN=right></A>
<HEAD>
<TITLE>Erreur avec l'instruction switch</TITLE>
<META NAME="description" CONTENT="Erreur avec l'instruction switch">
<META NAME="keywords" CONTENT="Introduction_ANSI_C">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso_8859_1">
<LINK REL="STYLESHEET" HREF="Introduction_ANSI_C.css" tppabs="http://www.linux-kheops.com/doc/ansi-c/Introduction_ANSI_C.css">
<LINK REL="next" HREF="node171.htm" tppabs="http://www.linux-kheops.com/doc/ansi-c/node171.htm">
<LINK REL="previous" HREF="node169.htm" tppabs="http://www.linux-kheops.com/doc/ansi-c/node169.htm">
<LINK REL="up" HREF="node164.htm" tppabs="http://www.linux-kheops.com/doc/ansi-c/node164.htm">
<LINK REL="next" HREF="node171.htm" tppabs="http://www.linux-kheops.com/doc/ansi-c/node171.htm">
</HEAD>
<BODY BACKGROUND="marge.gif" tppabs="http://www.linux-kheops.com/doc/ansi-c/icons.gif/marge.gif" TEXT=#000000 LINK=#FF0000 VLINK=#1809BB >
<!--Navigation Panel-->
<A NAME="tex2html3770"
HREF="node171.htm" tppabs="http://www.linux-kheops.com/doc/ansi-c/node171.htm">
<IMG WIDTH="77" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
SRC="next_motif.gif" tppabs="http://www.linux-kheops.com/doc/ansi-c/icons.gif/next_motif.gif"></A>
<A NAME="tex2html3766"
HREF="node164.htm" tppabs="http://www.linux-kheops.com/doc/ansi-c/node164.htm">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
SRC="up_motif.gif" tppabs="http://www.linux-kheops.com/doc/ansi-c/icons.gif/up_motif.gif"></A>
<A NAME="tex2html3760"
HREF="node169.htm" tppabs="http://www.linux-kheops.com/doc/ansi-c/node169.htm">
<IMG WIDTH="96" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
SRC="previous_motif.gif" tppabs="http://www.linux-kheops.com/doc/ansi-c/icons.gif/previous_motif.gif"></A>
<A NAME="tex2html3768"
HREF="node1.htm" tppabs="http://www.linux-kheops.com/doc/ansi-c/node1.htm">
<IMG WIDTH="96" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents"
SRC="contents_motif.gif" tppabs="http://www.linux-kheops.com/doc/ansi-c/icons.gif/contents_motif.gif"></A>
<A NAME="tex2html3769"
HREF="node174.htm" tppabs="http://www.linux-kheops.com/doc/ansi-c/node174.htm">
<IMG WIDTH="59" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index"
SRC="index_motif.gif" tppabs="http://www.linux-kheops.com/doc/ansi-c/icons.gif/index_motif.gif"></A>
<BR>
<B> Suivant:</B> <A NAME="tex2html3771"
HREF="node171.htm" tppabs="http://www.linux-kheops.com/doc/ansi-c/node171.htm">Erreur sur les tableaux</A>
<B> D閎ut:</B> <A NAME="tex2html3767"
HREF="node164.htm" tppabs="http://www.linux-kheops.com/doc/ansi-c/node164.htm">Le b阾isier</A>
<B> Pr閏閐ent:</B> <A NAME="tex2html3761"
HREF="node169.htm" tppabs="http://www.linux-kheops.com/doc/ansi-c/node169.htm">Erreurs avec les priorit閟</A><HR>
<BR>
<BR>
<!--End of Navigation Panel-->
<!--Table of Child-Links-->
<A NAME="CHILD_LINKS"><strong>Paragraphes</strong></A>
<UL>
<LI><A NAME="tex2html3772"
HREF="node170.htm#SECTION001861000000000000000" tppabs="http://www.linux-kheops.com/doc/ansi-c/node170.htm#SECTION001861000000000000000">
Oubli du <TT>break</TT></A>
<LI><A NAME="tex2html3773"
HREF="node170.htm#SECTION001862000000000000000" tppabs="http://www.linux-kheops.com/doc/ansi-c/node170.htm#SECTION001862000000000000000">
Erreur sur le <TT>default</TT></A>
</UL>
<!--End of Table of Child-Links-->
<HR>
<H1><font COLOR=#1809BB><A NAME="SECTION001860000000000000000">
Erreur avec l'instruction <TT>switch</TT></A>
</font></H1>
<H2><font COLOR=#1809BB><A NAME="SECTION001861000000000000000">
Oubli du <TT>break</TT></A>
</font></H2>
L'instruction de s閘ection a pour syntaxe :
<I>instruction-s閘ection</I> :
<BR>
<IMG WIDTH="20" HEIGHT="14" ALIGN="BOTTOM" BORDER="0"
SRC="img3.gif" tppabs="http://www.linux-kheops.com/doc/ansi-c/img3.gif"
ALT="$\Rightarrow$"> <TT>switch (</TT>
<I>expression</I>
<TT>)</TT>
<I>instruction</I>
<BR>
La notion d'alternative de la s閘ection n'apparait pas dans la syntaxe : le
programmeur doit les r閍liser par une liste d'instruction 閠iquett閑
par <TT>case</TT> <I>expression-constante</I> et termin閑 par <TT>break</TT>.
En cas d'oubli du <TT>break</TT>, une catastrophe s'ensuit.
<P><H2><font COLOR=#1809BB><A NAME="SECTION001862000000000000000">
Erreur sur le <TT>default</TT></A>
</font></H2>
L'alternative
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -