Identifiers:

All the words that we will use in c are keywords or identifiers. keywords are predefined and can’t be changed by the users, While identifiers are used to give names to entities likes variables, arrays, functions and etc.

There are some rules naming identifiers as:

  • The name should consist of only alphabets (upper case and lower case), digits and underscore sign ( _ ).
  • First character of identifier should be an alphabets or underscore.
  • Name should not be a keyword.
  • because c is case sensitive language, so upper case and lower case letter are considered different. for example code and CODE, Code, cOde, coDe, codE all are different.

Data Types:

There are four basic data types as: int, char, float, double. The size and range of different types on 16 bit machine as:

Data Types Data types with qualifier Size(Bytes) Range
char Signed char 1 byte -128 to 127
Unsigned char 1 byte 0 to 255
int Signed int 2 byte -32768 to 32767
Unsigned int 2 byte 0 to 65535
Signed short int 1 byte -128 to 127
Unsigned short int 1 byte 0 to 255
Signed long int 4 byte -2147483648 to 2147483647
Unsigned lon int 4 byte 0 to 4294967295
float float 4 byte 3.4E-38 to 3.4E+38
double double 8 byte 1.7E-308 to 1.7E+308
double Long double 10 byte 3.4E-4932 to 1.1E+4932

Constants:

Constant is a value that cannot be changed during execution of the program. there are three types of constants:

  • Numeric constants:- Numeric constants consist of numeric digits, they may or may not have decimal points ( . ).
    • integer constants : Integer constants are whole numbers which doesn’t consist decimal point( . ).
      • Decimal (0,1,2,3,4,5,6,7,8,9) (base 10)
      • Octal (0,1,2,3,4,5,6,7) (base 8)
      • Hexadecimal (0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F) (base 16)
    • real constants : real constants are also known as floating point constants. it contains decimal points.
  • Character constants : Character constants is a single character that is enclosed with single quotes ( ‘  ‘ ). Every character constant has a unique integer value associated with it.and that integer is the numeric value of character in the machine’s character code. ASCII values are as:

A to Z   ASCII values are ( 65 to 90 )

a to z    ASCII values are ( 97 to 122 )

0 to 9   ASCII values are ( 48 to 57 )

;  ASCII values are ( 59 )

  • String Constants : A string constant has zero, one or more than more characters. A string constant is enclosed within double quotes ( ” ” ).

Variables:

Variable is a name that can be used to  store values. Variables can store different values but one at a time and these values can be changed during execution of the program. A data type is associated with each variables.

Declaration of variables:

It is must to declare a variable before using it. Syntax for declaration of variables:

<data type> <variable name>;

Initialization of variable:

 when we declare a variable it contains undefined value also known as garbage value. If we want then we can assign some initial values to variable during declaration itself.

 for example: int a ; // declaration of variable

int b = 5 ; // initialization of variable

Expression :

An expression is a combination of operators, constants, variables and function calls. The expression can be arithmetic, logical or relational.

Statements :

A statement is executable part of a  program and gives instruction to computer to do some actions.

42 Replies to “What are the basic elements and how to use them in C?”

  1. I’m really impressed with your writing skills as well as with the layout on your weblog. Is this a paid theme or did you modify it yourself? Anyway keep up the excellent quality writing, it is rare to see a great blog like this one today..

  2. always i used to read smaller articles or reviews that as well clear their motive, and that is also happening with this piece of writing which I am reading at
    this place.

  3. Terrific post however , I was wondering if you could write a litte more on this topic? I’d be very thankful if you could elaborate a little bit further. Cheers!

  4. Spot on with this write-up, I actually think this amazing site needs a lot more attention. I’ll
    probably be back again to read more, thanks for
    the advice!

  5. Having read this I believed it was really enlightening.
    I appreciate you taking the time and energy to put this
    information together. I once again find myself spending way too much time both reading and posting comments.
    But so what, it was still worthwhile!

  6. great submit, very informative. I ponder why
    the opposite specialists of this sector don’t
    notice this. You must proceed your writing. I am confident, you have a huge readers’ base already!

  7. Thanks for any other great article. Where else may
    anyone get that type of information in such a perfect approach of writing?
    I’ve a presentation next week, and I’m on the search for such info.

  8. Hi! I could have sworn I’ve been to this web site before but after looking at some of the articles I realized it’s new to me. Anyhow, I’m certainly happy I stumbled upon it and I’ll be book-marking it and checking back regularly!

  9. fantastic points altogether, you simply received a new reader.

    What might you suggest in regards to your
    submit that you simply made a few days ago? Any positive?

    1. Hi Erma, It is really great to see that people appreciates what you are doing. I am really glad that you like my blogs.
      And yes I am working towards that people can get notification about my new posts.

      And if you want me to write on any specific topic, you can tell me, i will try to write on as well. Thank you once again.

    1. I am really grateful that you really like my web site and visit daily. It means a lot to me and encourage me to keep going. Thank you.

  10. Hello there. I found your site by way of Google even as searching for a related topic, your website came up. It seems good. I’ve bookmarked it in my google bookmarks to visit then.

  11. Nice blog right here! Also your web site quite a bit up fast! What web host are you the usage of? Can I am getting your associate link on your host? I wish my site loaded up as quickly as yours lol
    Wow, marvelous blog structure! How lengthy have you been running a blog for? you made running a blog look easy. The entire glance of your website is magnificent, as smartly as the content material!
    I am now not positive the place you are getting your information, however great topic. I must spend some time studying much more or understanding more. Thank you for excellent information I used to be searching for this information for my Hobby. If You get an opportunity have a look at my own web page:
    photography workshop

    1. It is pretty good here,hope everyone is safe and healthy. I am glad that you people like it, Thank you 🙂

  12. I think everything published made a great deal of sense. But, consider this, what
    if you typed a catchier post title? I am not suggesting your information is
    not solid., but what if you added a post title that makes people want more?
    I mean Elements of C – Step by Step JAVA is a little boring.

    You ought to look at Yahoo’s front page and see how they write post
    headlines to grab people to click. You might add a related video or
    a picture or two to grab readers interested about everything’ve written. In my opinion, it might bring your website a little livelier.

    1. I am really thankful for your generous and true comment. Surely i will try to implement what you have suggested me. Thank you very much.

Leave a Reply

Your email address will not be published. Required fields are marked *