C Programming Overview - Basics, Keywords, Data Types, and Variables

c language n.w
1 / 19
Embed
Share

Learn about the fundamentals of C programming language, including its history, program structure, identifiers, keywords, data types, and variables. Dive into essential concepts to kickstart your C programming journey effectively.

  • C Programming
  • Basics
  • Keywords
  • Data Types
  • Variables

Uploaded on | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. C Language B. DHIVYA 17PCA140 II MCA

  2. About C C was invented to write an operating system called UNIX. C is a successor of B language, which was introduced around 1970. The language was formalized in 1988 by the American National Standard Institute. (ANSI). The UNIX OS was totally written in C by 1973.

  3. C Program Structure A C program basically consists of the following parts: a. b. c. d. e. Preprocessor Commands Functions Variables Statements & Expressions Comments

  4. Identifiers A C identifier is a name used to identify a variable, function, or any other user-defined item. An identifier starts with a letter A to Z or a to z or an underscore _ followed by zero or more letters, underscores, and digits (0 to 9). C does not allow punctuation characters such as @, $, and % within identifiers. C is a case sensitive programming language.

  5. Keywords The following list shows the reserved words in C. auto break enum case char const continue goto default if do else Long switch register typedef extern return union float short unsigned for signed void sizeof static while int double volatile

  6. Data Types In the C programming language, data types refer to an extensive system used for declaring variables or functions of different types. The type of a variable determines how much space it occupies in storage and how the bit pattern stored is interpreted.

  7. Data Types Types and Description : 1. Basic Types: They are arithmetic types and consists of the two types: (a) integer types and (b) floating-point types. 2. Enumerated types: They are again arithmetic types and they are used to define variables that can only be assigned certain discrete integer values throughout the program. 3. The type void: The type specifier void indicates that no value is available. 4. Derived types: They include (a) Pointer types, (b) Array types, (c) Structure types, (d) Union types and (e) Function types.

  8. Variables A variable is nothing but a name given to a storage area that our programs can manipulate. Each variable in C has a specific type, which determines the size and layout of the variable's memory;

  9. Variables Types: Char : Typically a single octet(one byte). This is an integer type. int : The most natural size of integer for the machine. Float : A single-precision floating point value. Double : A double-precision floating point value. Void : Represents the absence of type.

  10. Operators C language is rich in built-in operators and provides the following types of operators: a. b. c. d. e. f. Arithmetic Operators Relational Operators Logical Operators Bitwise Operators Assignment Operators Misc Operators

  11. Decision Making in C if statement if...else statement The if...else if...else Statement Nested if statements switch statement

  12. Loops while for do ..while nested loops

  13. Functions Every C program has at least one function, which is main(), and all the most trivial programs can define additional functions. You can divide up your code into separate functions. A function declaration tells the compiler about a function's name, return type, and parameters. A function definition provides the actual body of the function.

  14. Scope of Variables Types: Local Variables Global Variables Register Variable Static Variable

  15. Arrays An array is used to store a collection of data, but it is often more useful to think of an array as a collection of variables of the same type.

  16. Arrays Declaring Arrays: To declare an array in C, a programmer specifies the type of the elements and the number of elements required by an array as follows: type arrayName [ arraySize ]; Example: int a [10];

  17. Files A file represents a sequence of bytes, does not matter if it is a text file or binary file. C programming language provides access on high level functions as well as low level (OS level) calls to handle file on your storage devices.

  18. Files Opening Files: FILE *fopen( const char * filename, const char * mode ); Closing a File: int fclose( FILE *fp ); Writing a File: int fputc( int c, FILE *fp ); Reading a File: int fgetc( FILE * fp );

  19. THANKYOU

Related


More Related Content