case 1:             { //question is about this curly brace                 int val;                 scanf("%d", &amp;val);                 if(top1 == NULL){                     enqueue(top1, val, bottom1);                 }                 else{                     enqueue(top1, val);                 }                 break;             }   Without the curly brace after case 1: it gave an error: *     a label can only be part of a statement and a declaration is not a   statement: int val;   *
3450
I've always wondered this - why can't you declare variables after a case label in a switch statement?  In C++ you can declare variables pretty much anywhere (and declaring them close to first use is obviously a good thing) but the following still won't work:  switch (val)   {   case VAL:     // This won't work   int newVal = 42;     break; case ANOTHER_VAL:     ...   break; }     The above gives me the following error (MSC):     initialization of 'newVal' is skipped by 'case' label   This seems to be a limitation in other languages too.  Why is this such a problem?
66809
When I write {{\tilde{C}}^{0}_{har}}^{\Gamma} (or the same with fewer curly brackets) in Tex I obtain a double superscript error and I can't solve it. Does someone know how to fix this?
75996
In the spirit of questions like :  Which style do you use for an infinite loop, and why?   while (true) { } do { } while (true); for (;;) { } label: ... goto label;
47995
I'm trying to work through LaTeX Beginner's Guide by Stefan Kottwitz. Here's where I got stumped:  \documentclass{article} \newcommand{\keyword}[2][\bfseries]{{#1#2}} \begin{document} \keyword{Grouping} by curly braces limits the \keyword{scope} of \keyword[\itshape]{declarations}. \end{document}   The output adds boldface to "Groupings" and "scope," while "declarations" is italicized. I do not understand this syntax. I vaguely get that \bfseries is the "default" and \itshape got specifically subbed in for "declarations" but I cannot follow Kottwitz's explanation:     Let's look again at the bold marked line in the code. By using [\bfseries], we introduced an optional parameter. We refer to it with #1. Its default value is \bfseries. Since we used a declaration this time, we added a pair of braces to ensure that only the keyword is   affected by the declaration. Later in the document, we gave [\itshape]   to \keyword, changing the default formatting to italics.   Can I get a second opinion/explanation of what is going on here?
16217
I've just read this  from Reddit.  They mention and and or being "Alternative Tokens" to &amp;&amp; and ||  I was really unaware of these until now. Of course, everybody knows about the , but and and or? Since when? Is this a recent addition to the standard?  I've just checked it with Visual C++ 2008 and it doesn't seem to recognize these as anything other than a syntax error. What's going on?
16574
This is probably a really basic question:  When I write code, I want to achieve a logical and readable structure of the lines, where I can see which brace closes which brace.  \begin{equation}  \begin{multlined}   Here is some random equation that goes on for a long time  \end{multlined} \end{equation}   If the equation (here I am referring to the source code, not the compiled document) goes on to where it needs to jump to the next line, it is left-aligned, which screws up the indentation. I can manually add some spaces, but then if I change the size of the window, it realigns and is wrong again. What is the right way to achieve a logical indentation?  My apologies if this has been asked before; I did not find it on previously asked questions.  Edit: Sorry, forgot to mention, I am using writelatex.com as my editor.
38621
I am not sure what the problem is but I keep receiving this error when I try to use a while statement in my code.     Invalid token 'while' in class,   struct, or interface member   declaration   I want to use a while loop to have something continuously update while a statement is true.  The rest of my code is rather long but whenever I type in the syntax:  while(a&lt;b) { //do whatever i want it to do here }   It gives me that compiler error right off the bat. Not quite sure what the problem is. I am doing this in a C# windows application under the Form1.cs file with all the other event handlers (for buttons and such).  Thanks!    I was unaware that loops had to be placed within a method (fairly new to c#), but I tried it and no errors were returned. Thanks for your help everybody!  Previously, I just had the loop within the main class of the program.
38016
I try to make a table for language manual. Could anybody help me to manage curly brackets in the cells of a table?  Like this:    I tried to do it like  but I could't manage it.
25759
I have encountered comparisions of variables to string literals multiple times over the years which had one character prefixing the variable and the literal, e.g.  if [ "x$A" = "xtrue" ]; then   in order to check whether $A is "true".  I assume this is done to achieve shell compatibility or to work around a longterm bug, an unintuitive behavior, etc. Nothing obvious comes to mind.  Today I figured I want to know the reason, but my research didn't turn up anything. Or maybe it's just me making something out of a rather frequent exposure to rare occurances.  Is this practice still useful, maybe even best?
56146
I long thought that in C, all variables had to be declared at the beginning of the function. I know that in C99, the rules are the same as in C++, but what are the variable declaration placement rules for C89/ANSI C?  The following code compiles successfully with gcc -std=c89 and gcc -ansi:  #include &lt;stdio.h&gt; int main() {     int i;     for (i = 0; i &lt; 10; i++) {         char c = (i % 95) + 32;         printf("%i: %c\n", i, c);         char *s;         s = "some string";         puts(s);     }     return 0; }   Shouldn't the declarations of c and s cause an error in C89/ANSI mode?
18421
What is the difference between \emph{...} and {\em ...}?  When to use each of them?
38518
How do I produce a conditional expression with large brackets? For example: X = 0 if a=1, 1 otherwise, with a large left bracket and specifying each condition in a line?
67578
I haven't written any C++ in years and now I'm trying to get back into it. I then ran across this and thought about giving up:  typedef enum TokenType {     blah1   = 0x00000000,     blah2   = 0X01000000,     blah3   = 0X02000000 } TokenType;   What is this? Why is the typedef keyword used here? Why does the name TokenType appear twice in this declaration? How are the semantics different from this:  enum TokenType {     blah1 = 0x00000000,     blah2=0x01000000,     blah3=0x02000000 };
1789
Sometimes writing braces and omitting them produces the same result:  \tilde{\psi}  \mathrm{e}^{\mathrm{i} \pi}   vs  \tilde \psi   \mathrm e^{\mathrm i \pi}   Or (taken from Werner's comment below)   \frac{1}{2} vs \frac12   If that's the case, how bad for the quality of my code is omitting them? Of course, if one compiles a pair of formulas, there is no difference. But, since I ignore how TeX works, my point is: if one writes long codes with these habits,   doesn't TeX go somehow crazy because I'm not writing as it expects?   For instance, does it have any effect on how fast are long documents compiled? Any reason to keep them?
85339
I want to write a three line equation with left curly brace for all three, right curly brace for bottom two ones and some text at right bottom of right curly brace. All with proper alignment. I wrote following code.  \documentclass{article} \usepackage{amsmath,amssymb,amsfonts} \usepackage{flexisym}  \begin{document}  \begin{equation*}     \begin{aligned}         K_{\mathbb{A}_{Ui}} =\begin{cases}             D                =\ g^{ \frac{ (\alpha + r) }{\beta} }\\             \left.\begin {aligned}                 &amp;D_j           &amp;=\ &amp;g^r . H(j)^{r_j} \\                 &amp;D_j\textprime &amp;=\ &amp;g^{r_j}             \end{aligned}\right\} \forall j \in   \mathbb{A}_{Ui}         \end{cases}         \end{aligned}     \end{equation*}  \end{document}   It is giving some problems.   Second and Third lines are aligned but they are not aligned with the first one. I want alignment to occur at start of "D", "=" and "g" for all three. Right now, the text at right of right curly brace is coming at center. I want it to shift down and come at bottom.   Please help. Thanks in advance.
22801
In many languages assignments are legal in conditions. I never understood the reason behind this. Why would you write:  if (var1 = var2) {   ... }   instead of:  var1 = var2; if (var1) {   ... }
3980
I have  $m\times n = n + n + \dots + n$    in my text right now, but I would like to put a curly brace under the \dots to emphasize that there are m,n's involved. How would I do this?