tutorials about C strucutres

Discussion in 'C Programming' started by tanny, Jul 31, 2006.

  1. tanny

    tanny Guest

    Dear Friends

    can u get me some links where i can find tutorials about C stuructures
    & Unions.


    Thanks in advance
    Thanujkumark
    tanny, Jul 31, 2006
    #1
    1. Advertising

  2. tanny

    Kenneth Guest

    Kenneth, Jul 31, 2006
    #2
    1. Advertising

  3. Kenneth said:

    > http://www.sysprog.net/cstruct.html


    Oh deary deary me. Here's some of the stuff from that page.

    "Usually, the structure definition is saved as an #include member in a
    maclib library,"

    Er, no. Usually the structure definition is saved in a source file, the
    details of which are entirely a matter between you and your system.

    "but it can be placed at the top of the program."

    Or, indeed, in other places.

    "The commonest way to define structures is with a typedef, as shown below."

    No. A typedef doesn't define anything.

    "typedef struct country
    {
    char name[20];
    int population;
    char language[10];
    } Country;

    This defines a structure which can be referred to either as 'struct
    country' or Country, whichever you prefer."

    In a way, that's true. This bit: struct country { char name[20]; int
    population; char language[10]; } defines a new type, and the rest creates a
    synonym, 'Country', for that type.

    "Strictly speaking, you don't need a tag name both before and after the
    braces if you're not going to use one or the other."

    But really strictly speaking, the name after the braces is not a tag name.
    It's a type name.

    "But it's standard practice to put them both in and to give them the same
    name, but with the one after the braces starting with an uppercase letter."

    No, that is not standard practice at all.

    That slice of the page was sufficiently broken that I looked no further. I
    cannot recommend that tutorial.

    --
    Richard Heathfield
    "Usenet is a strange place" - dmr 29/7/1999
    http://www.cpax.org.uk
    email: rjh at above domain (but drop the www, obviously)
    Richard Heathfield, Jul 31, 2006
    #3
  4. tanny

    John Bode Guest

    Richard Heathfield wrote:
    > Kenneth said:
    >
    > > http://www.sysprog.net/cstruct.html

    >


    [snip]

    >
    > That slice of the page was sufficiently broken that I looked no further. I
    > cannot recommend that tutorial.


    It gets better (or worse, depending on your POV). Here's a snippet
    from the page on design:

    "Assembler, COBOL, PL/I and Fortran are all procedural languages: each
    program contains a series of procedures (or subroutines) that modify
    the variables in the program's working storage.

    C is a functional language: each function (or subroutine) modifies only
    the variables in its own work area. C++ is an 'object-directed'
    language: you can write it either like C or using an object-oriented
    approach."

    Uh, C is a *functional* language in the same way that Fortran 77 is an
    object-oriented language; that is, *not at all*.

    The person who wrote these pages may be an expert in programming
    mainframes, but his knowledge of the C language is spotty at best, and
    most of his explanations are incomplete or downright wrong.

    I would not recommend this tutorial either. It's just another data
    point in favor of my theory that 90% of all web-based C tutorials are
    crap.
    John Bode, Jul 31, 2006
    #4
  5. tanny

    Guest


    > I would not recommend this tutorial either. It's just another data
    > point in favor of my theory that 90% of all web-based C tutorials are
    > crap.


    I'd say that check out "The C Programming Language" by Kernighan and
    Ritchie. I know it's not a link, but there aren't any better examples
    out there.

    --Adam
    , Jul 31, 2006
    #5
  6. "tanny" <> wrote (corrected):

    > Can you get me some links where I can find tutorials about
    > C structures and unions?


    Yes. Here is one such link:

    http://c-faq.com/struct/index.html


    --
    Cheers,
    Robbie Hatley
    Tustin, CA, USA
    lone wolf intj at pac bell dot net
    (put "[usenet]" in subject to bypass spam filter)
    home dot pac bell dot net slant earnur slant
    Robbie Hatley, Jul 31, 2006
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Chaos Master

    Good books/tutorials on VHDL?

    Chaos Master, Feb 18, 2004, in forum: VHDL
    Replies:
    1
    Views:
    582
  2. Pow
    Replies:
    1
    Views:
    3,642
    avidan_e
    May 11, 2006
  3. Eric DELAGE
    Replies:
    2
    Views:
    704
  4. Replies:
    0
    Views:
    3,450
  5. sd
    Replies:
    4
    Views:
    3,038
Loading...

Share This Page