whether "abc"[0] in standard C

From: ccwork (ccwork_at_hotmail.com)
Date: 02/28/05


Date: 28 Feb 2005 01:18:15 -0800

Hi all,
    I found some people writing code as:
    /****************** sample code ********************/
    int ans;
    ...
    printf("%c\n", " yn"[ans]);
    /***************** sample code end *****************/

    The value of variable "ans" will be an index to print ' ', 'y' or
'n'. Is this a syntax " yn"[ans] in standard C?



Relevant Pages

  • Re: Program compression
    ... be interested in Seed7. ... syntax and semantic can be defined in Seed7: ... Are there standard packages available to provide these as ... Now the ability to define *variants* of those common operators ...
    (comp.programming)
  • Re: What could J4 (or WG4) do
    ... I really have no expertise in the OO arena, either in COBOL or otherwise. ... for example it's 'INSPECT REPLACING' show the standard syntax IMMEDIATELY ... may only be used to represent the leftmost leading numeric character ...
    (comp.lang.cobol)
  • Declaration to get 8-bit (or 16-bit) integer?
    ... Supported by all the current compilers that I've tried it on. ... Not likely to become standard in the foreseeable future. ... Syntax standard-conforming, but semantics not guaranteed of course. ... The meaning of the code not obvious to anyone but a Fortran guru. ...
    (comp.lang.fortran)
  • Re: The Promise of Forth
    ... not characters, you can't add characters, nor multiply them, ... It isn't standard, and it isn't used widely enough. ... Right, and no convenient syntax for local variables is standard, ... there is one standard syntax for locals. ...
    (comp.lang.forth)
  • Re: RfD - Enhanced local variable syntax, v4 (long)
    ... My syntax is from spring 1992, ... I prefer the automatic scoping, too, but won't recommend it for a standard ... A simpler form would be that locals are visible at least up to the ... be with SCOPE ... ...
    (comp.lang.forth)