Welcome to the csamplecode.in . The main motive of this site is used to learn the C language easily in this site we discuss about the total c language concepts like variables, control structures, Arrays, Strings, Functions, Pointers, Structures and Files concepts in addition we our guiding with sample programs.
C Language was developed by Dennis Ritchie in 1972 at bell labs in U.S.A.and it is a Middle Level Language.
C History:Algol is the ancient and traditional language to all the languages it is in binary format. From this language BCPL was developed by Ken Thomson. BCPL was High level language and it is not solved some problems at that time. From BCPL another language was dervied and named it as B by Martin Richards in 1969 at cambridge university. From these two languages one more language was dervied and it is named as "C" by Dennis Ritchie.
C Features: Simple: C is a simple language because it has 32 keywords. Keyword is a reserve word which is taken from english dictionary and given a syntax for that word.
Procedure Oriented Programming Language: C is a Procedure Oriented Programming Languages causes code re usability.
Modularity: Modularity means breaking the project into sub modules, After developing the sub modules and again it is rejoined. C supports Modularity.
Fast Complier: C complier complies the program every fast than the other compliers becuase it is a middle level language.
System Indepedent : C creates system independent language becuase it is a middle level language.
Pointers: Pointers are special variable used to store the other variable address. Pointers are used to allocate dynamic memory allocation in the program.
Functions: c is a Procedure oriented programming language and we can define our own user defined functions.
C Characteristics: 1. C is a Strictly case senstive language
2. Every Program should start with main function.
3. Every Statement should end with semi-colon(;) called as line terminator.
4. Every block open with a { and end with } called as Delimiters.
5. Every function end with () called as parenthesis
Identifiers
Identifiers are defined by the programmer to identify the user defined function, variables, structures names etc.to specify the names for the identifiers we must follow some rules and regulations these rules are called as identifiers rules and regulations.
Rule1: Identifier name may any length of long but at least one minimum character should be mentioned.
Rule 2: Identifier name may be alphanumeric means identifier name can have numbers and alphabets but identifiers should not start with numbers and it can end with numbers.
Rule 3: Identifier name should not match with keyword.
Rule 4: Identifier name should not contain spaces in between the words if the identifier is more than one token it can separated by underscore( _ ).
Rule 5: Identifier name should not contain special characters.
Rule 6: identifier name may be upper case/ lower case once we define the name with that name only we must access other wise it show the error.
Example for Valid Identifiers :
- Student_Name
- firstnumber
- m1
- S.No
- student name
- int
Data types: We Use data types for two reasons
1. what type of data variable is storing to perform the operations.
2. How much memory should allocate for the variable.
Data type are classified into these types
- Predefined datatypes
- Numeric Datatypes
- int
- float
- double
- Non Numeric datatypes
- char
- string
- User Defined datatypes
- Structures
- Unions
- Enums
Keywords
Keyword is a reserve word taken form English dictionary and given a syntax for us. These word should be in lower case. We have 32 keywords in C Language and it became simple for us.Keyword list :
auto | break | case | char | const | continue | default | do |
double | else | enum | extern | float | for | goto | if |
int | long | register | return | short | signed | sizeof | static |
struct | switch | typedef | union | unsigned | void | volatile | while |