Fundamentals of C

1

Fundamentals of C

Introduction

Every programming language work with some rules for developing good and error free program. we know C is the powerful language, but it also work with the low level language , so the user must be aware with this type of difficulties like character set, keyword, variables , constants and also about the various types.

Character set

character set is known as predefined symbols that can be used in a particular language. for eg. character set of English language is A to Z and a to z. but in in C language it divides in four types;

(a) Letter    (b) Digits    (c) Special Characters     (d) White Space

 (a) Letter         >>        Upper Case A to Z

                                      Lower Case a to z

(b) Digits                       0 to 9

(c) Special Characters     , . / < > ? ; ' : " [ ] { } \ | + = _ - ( ) * & ^ % $ # @ ! ~ `

(d) White Space            Blank space , Horizontal tab , Carriage return , New line , formfeed 

Identifiers         

Identifiers means that which identifies the elements of the program. it can be variable , array, function name etc . If we say in simple language, then identifiers are the names given by the users. now the followings rules or identifiers :

  • Identifiers name can have letters , digits , or underscore.
  • Identifiers name always starts with a character or underscore , the first character can not be digits 
  • No special character or blank space can be used 
  • Keyword cannot be used as identifiers name.
  • Maximum number of character allowed is 31.

valid identifiers :    area, student_name, _rollno. x10 (it is valid because this segment work with rule 2)

invalid identifiers :   2x , 1name , roll-no ( it is invalid because this segment don't work with rule it break the rule no. 2 and used the ist character is no. )

Keywords in C language

Keywords are reserved words that have a predefined meaninig. A keywords can not be used as an identifiers name. there are 32 keywords availabel in C


Constants

Constant means whose value remains always same throughout the execution of program. Following are the constants supported by C language.

Constant 

  • Numeric constants 
  • Character constants
  • symbolic constatns

Numeric constants

  • Integer constant        (integer constant are the integer valued number such as positive,negtive, eg.                                                                                    5,45,-86,-3562).
  • floating constant       (floating constant are 584.54, 5.5, )

Character constant 

  • single character constant  (single character is enclosed by single quote eg. 'X', 'a' ;
  • string constant                   ( string constant enclosed by double quote eg "Well Come", "A";

Symbolic constant

symbolic constant is the name used instead of a numerical constant . symbolic constant are created with the help of define preprocessor directives eg; #define X 10 , #define PI= 3.14;

2.5 Variables

a variable refers to the entity whose value can change Aaj duty in the execution of program variable are the storage locations in the memory that are given some name and are used hold some data this data may be integer float character or string the name of variable always begins with an alphabet only letter digits and underscore can be used .as C is a case sensitive language show the name of variable written in lowercase letter is treated differently than the uppercase letter for example book, book a treated differently by the compiler some valued various name are number ,name, age ,salary

rules for naming variable 

1 the first character of variable must be alphabet or underscore 

2 to the length of variable can be long but must of the compiler recognise first 8 character only

3 no special symbol is allowed in variable name accept underscore

4 commas and blank space are not allowed in variable name

2.6 data type in C 

data type is defined as finite set of value that an identifier can have and the valid operation that can be performed on these values data type in C can be classified as data type

basic data type 
  • integer 
  • floating 
  • character 
derived data type 
  • array 
  • string
  • pointer 
user defined data type 
  • structure 
  • union 
  • Enumeration 
void data type

2.11 Statements
statement it is the smallest logical entity of C program the statement is the only entity in  a C program which can exist in independently e n a statement in C language terminated with a semicolon just as the use of full stop at the end of every sentence in English language for example x=y+z; is a statement.

                                                                people also ask these question 

What do you mean by data type?

An data  type, in writing computer programs, is a grouping that determines which kind of significant worth a variable has and what sort of numerical, social or sensible tasks can be applied to it without causing a mistake.


Name the basic data type?

The  basic categories of data types: Integral, Floating Point, Character, Character String, and composite types, 


What do you mean by wrapping around?

 a word processing feature that naturally moves a word for which there is deficient space from the finish of one line of text to the start of the following.


What is the range of int data type?

-2,147,483,648 to 2,147,483,647


What do you mean by statement?

An statement is an order given to the PC that instruct the PC to make a particular move, like display to the screen, or gather input.


What is the maximum value that an integer variable can take ?

The maximum value that an integer variable can take is 2,147,483,647


How much memory is required to store a value of type double ?

For type double 8 bytes is required to store a value


what is meant by simple statement and compound statement ?

Simple statement is what we write as #include<studio.h> before writing our program. And the compound statement is called that which is used inside the program such as if, else, then, for, etc.


What is difference between initialization and assignment?

What is the contrast among initialization  and assignment? initialization  gives a variable an underlying worth exactly when it is made. assignment gives a variable a worth sooner or later after the variable is made.


What is executable statement ?

An executable statement is one that is clear and without any mistakes. If there is any mistake in your program then your program will not run and it will not be an executable statement. 


Tags

Post a Comment

1Comments
Post a Comment