Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #22144

Re: Sorry for interrupt,because my mother language is not English,it may be a little confused to read the c programming language.

From Ike Naar <ike@iceland.freeshell.org>
Newsgroups comp.lang.c
Subject Re: Sorry for interrupt,because my mother language is not English,it may be a little confused to read the c programming language.
Date 2012-06-12 08:04 +0000
Organization A noiseless patient Spider
Message-ID <slrn3vfsjtdtvr.o50.ike@iceland.freeshell.org> (permalink)
References <7b7c33d0-07e6-48ba-bd4b-f947e965f9bf@googlegroups.com>

Show all headers | View raw


On 2012-06-12, Zhang Yuan <zhabgyuan1993@gmail.com> wrote:
> charpter6
> 6.1 basic
>
> "The tag names this kind of structure, and can be used subsequently
> as a shorthand for the part of the 
> declaration in braces. "
>
> I don't understand it well.
> I refer to some native language(Chinese) translated from English.
> just literal translation.
>
> Will you put up an example for me to understand it?

They probably mean that with this type definition:

  struct S { int i; double d; };

the declaration

  struct S x;

can be seen as a shorthand for

  struct { int i; double d; } x;

Indeed, both declarations will declare a variable x that is
a struct type with an int member i and a double member d.

But there are subtle differences. For instance, with

  struct S x;
  struct S y;

x and y have the same type, and can be assigned to each other, like in

  x = y;

but with

  struct S x;
  struct { int i; double d; } y;

x and y have different types, and cannot be assigned to each other:

  x = y;

is not allowed.

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Sorry for interrupt,because my mother language is not English,it may be a little confused to read the c programming language. Zhang Yuan <zhabgyuan1993@gmail.com> - 2012-06-11 23:47 -0700
  Re: Sorry for interrupt,because my mother language is not English,it may be a little confused to read the c programming language. Ike Naar <ike@iceland.freeshell.org> - 2012-06-12 08:04 +0000
    Re: Sorry for interrupt,because my mother language is not English,it may be a little confused to read the c programming language. Zhang Yuan <zhabgyuan1993@gmail.com> - 2012-06-12 08:26 -0700
    Re: Sorry for interrupt,because my mother language is not English,it may be a little confused to read the c programming language. jgk@panix.com (Joe keane) - 2012-06-13 21:07 +0000
      Re: Sorry for interrupt,because my mother language is not English,it may be a little confused to read the c programming language. Ike Naar <ike@iceland.freeshell.org> - 2012-06-14 04:35 +0000
  Re: Sorry for interrupt,because my mother language is not English,it may be a little confused to read the c programming language. Barry Schwarz <schwarzb@dqel.com> - 2012-06-12 08:45 -0700
    Re: Sorry for interrupt,because my mother language is not English,it may be a little confused to read the c programming language. Zhang Yuan <zhabgyuan1993@gmail.com> - 2012-06-12 08:51 -0700

csiph-web