basics of c language

M

masood

Hi friends,
I am blank in c language,I would like to know the basics o c
language.Basically I want to make career in embedded systems.I need to
do the c on linux,please help me in this regard(programming c in
linux).
 
B

Ben Pfaff

masood said:
I am blank in c language,I would like to know the basics o c
language.Basically I want to make career in embedded systems.I need to
do the c on linux,please help me in this regard(programming c in
linux).

If you don't have specific questions, perhaps you should buy a
book or read a tutorial. This is a good place to get answers to
specific questions, but not a good place to learn C from a blank
slate. It's definitely not a good place to learn about Linux.
 
U

user923005

Hi friends,
I am blank in c language,I would like to know the basics o c
language.Basically I want to make career in embedded systems.I need to
do the c on linux,please help me in this regard(programming c in
linux).

0. Download a C compiler. If you are using a PC, I recommend the
Mingw system or the free version of the Microsoft compiler.
http://www.mingw.org/download.shtml
http://msdn.microsoft.com/vstudio/express/

1. Buy and read a C book. I recommend K&R2:
http://cm.bell-labs.com/cm/cs/cbook/
When you read the book, work every exercise in it.

2. Read the C-FAQ. It's actually a very good idea to read it before
posting to this group.
http://www.faqs.org/faqs/C-faq/

3. Now, you are ready to specialize. Try searches like this one:
http://www.google.com/search?client...hl=en&q=c+embedded+systems&btnG=Google+Search

HTH.
 
M

Malcolm McLean

masood said:
I am blank in c language,I would like to know the basics o c
language.Basically I want to make career in embedded systems.I need to
do the c on linux,please help me in this regard(programming c in
linux).
Indirection:
int x, y;
int *ptr;

*ptr = x;
y = *ptr;
ptr = &x;

quirk

if( x == y) means if x equals y.

Strings: there aren't any, or rather there is no string type. Just use
ASCIIZ arrays of characters instead.

Everything else works pretty much the same as in other languages, or is
intuitively obvious.
 
F

Flash Gordon

Malcolm McLean wrote, On 15/03/07 20:39:
Indirection:
int x, y;
int *ptr;

*ptr = x;

BANG! If you are going to give examples to someone who does not know the
language, at least don't make them gratuitously bad by writing to
obviously wild pointers.
y = *ptr;
ptr = &x;

quirk

if( x == y) means if x equals y.

Strings: there aren't any, or rather there is no string type. Just use
ASCIIZ arrays of characters instead.

No they are not. Or at least, there is no guarantee that strings have
anything to do with ASCII. Why not just say that they are date format
rather than a type made up of a sequences of characters terminated by a
nul character and leave it understandable (I doubt the OP knows what you
mean by ASCIIZ anyway) and completely correct?
Everything else works pretty much the same as in other languages, or is
intuitively obvious.

Apart from all the things that don't, like sequence points, or rather
their lack, making some things that are well defined in some other
languages (like Java I believe) undefined in C. Just one example off the
top of my head.

I might not have bother responding to your post had the first error not
been so serious in my opinion.
 
F

Flash Gordon

user923005 wrote, On 15/03/07 18:21:
0. Download a C compiler. If you are using a PC, I recommend the
Mingw system or the free version of the Microsoft compiler.
http://www.mingw.org/download.shtml
http://msdn.microsoft.com/vstudio/express/

As the OP wants to learn it in Linux I would recommend installing Linux
and using gcc!
1. Buy and read a C book. I recommend K&R2:
http://cm.bell-labs.com/cm/cs/cbook/
When you read the book, work every exercise in it.

Very good advice.
2. Read the C-FAQ. It's actually a very good idea to read it before
posting to this group.
http://www.faqs.org/faqs/C-faq/

Again, very good advice. However, the best place to look at this groups
FAQ is http://c-faq.com/ which is its home. There is also some useful
information and links at http://clc-wiki.net/
3. Now, you are ready to specialize. Try searches like this one:
http://www.google.com/search?client...hl=en&q=c+embedded+systems&btnG=Google+Search

News groups comp.arch.embedded and comp.os.linux.embedded might also be
of use, but the OP should read their FAQs and a few weeks of posts
before asking anything in either of those.
 
N

Nick Keighley

Everything else works pretty much the same as in other languages, or is
intuitively obvious.

- non-obvious operators (~, !, ^)
- use of {}
- use of ()
if (x < 0)
{
do_one_thing(0);
do_another_thing(0);
}
- placement of ;s
- ?: operator
- sizeof operator
- peculiar operator precedence (eg. &)
- break, continue
- extern, static
- function pointer syntax
- multi-dimension array syntax
- unions
- bitfields
- volatile


and that is just reading the K&R ToC
 

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,769
Messages
2,569,582
Members
45,067
Latest member
HunterTere

Latest Threads

Top