Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > tutorials about C strucutres

Reply
Thread Tools

tutorials about C strucutres

 
 
tanny
Guest
Posts: n/a
 
      07-31-2006
Dear Friends

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


Thanks in advance
Thanujkumark

 
Reply With Quote
 
 
 
 
Kenneth
Guest
Posts: n/a
 
      07-31-2006
http://www.sysprog.net/cstruct.html
http://www.sysprog.net/cunions.html

hope this helps
Kenneth

tanny wrote:
> Dear Friends
>
> can u get me some links where i can find tutorials about C stuructures
> & Unions.
>
>
> Thanks in advance
> Thanujkumark


 
Reply With Quote
 
 
 
 
Richard Heathfield
Guest
Posts: n/a
 
      07-31-2006
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)
 
Reply With Quote
 
John Bode
Guest
Posts: n/a
 
      07-31-2006

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.

 
Reply With Quote
 
adshea@gmail.com
Guest
Posts: n/a
 
      07-31-2006

> 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

 
Reply With Quote
 
Robbie Hatley
Guest
Posts: n/a
 
      07-31-2006

"tanny" <(E-Mail Removed)> 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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
system c/specman e tutorials Pow VHDL 1 05-11-2006 04:12 AM
Etching tutorials-or now for something completely different Technoholic Case Modding 71 09-27-2005 06:39 AM
Updated Networking Tutorials? =?Utf-8?B?UGFycm90?= Wireless Networking 3 06-20-2005 01:40 AM
PSL stmt embedded in VHDL: good tutorials somewhere? Eric DELAGE VHDL 2 04-06-2005 05:11 AM
Good books/tutorials on VHDL? Chaos Master VHDL 1 02-18-2004 09:24 PM



Advertisments