tutorials about C strucutres

T

tanny

Dear Friends

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


Thanks in advance
Thanujkumark
 
R

Richard Heathfield

Kenneth said:

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.
 
J

John Bode

Richard said:
Kenneth said:

[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.
 
A

adshea

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
 
R

Robbie Hatley

tanny said:
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top