Introduction to programming Language C, Data Types, Variables, Constants. - PowerPoint PPT Presentation

1 / 10
About This Presentation
Title:

Introduction to programming Language C, Data Types, Variables, Constants.

Description:

Introduction to programming Language C, Data Types, Variables, Constants. Basics of C Every program consists of one or more functions and must have main function – PowerPoint PPT presentation

Number of Views:79
Avg rating:3.0/5.0
Slides: 11
Provided by: Ahs99
Category:

less

Transcript and Presenter's Notes

Title: Introduction to programming Language C, Data Types, Variables, Constants.


1
Introduction to programming Language C, Data
Types, Variables, Constants.
  • Basics of C
  • Every program consists of one or more functions
    and must have main function
  • Functions consists of heading, arguments and
    compound statement
  • Every block begin with and end with
  • Every statement end with
  • // is used to insert single line comment

2
  • / / is used to insert multiple line
  • C Fundamentals
  • Character set
  • Identifiers and keyword
  • Basic data types
  • Int
  • Character
  • Float
  • Double
  • Qualifiers

3
C Fundamentals (contd.)
  • Constants
  • Integer constant
  • Decimal
  • Octal (start with 0)
  • Hexadecimal (start with 0x or 0X)
  • Unsigned and Long Integer constant (UL)
  • Floating point constant
  • Numerical accuracy (representation of 1.0)
  • Character constant (enclosed by apostrophes)
  • ASCII, EBCDIC
  • Escape sequences (non-printing characters)
  • String constant (enclosed in quotation marks)

4
C Fundamentals (contd.)
  • Variables
  • Declarations
  • Expressions-
  • Statements
  • Symbolic constants
  • define name text

5
Operators and expressions
  • Arithmetic operators (, -, , /, )
  • requires integer operands and second operand
    must be nonzero
  • Second operand of / must be nonzero
  • Rules of division
  • Type conversion ( (data type)) expression)
  • Precedence and associativity

6
Operators and expressions (Contd.)
  • Unary operators
  • Relational operators (lt,lt,gt,gt)
  • Equality Operators (,!)
  • Logical operators or connectives(,)
  • Act upon operands that are themselves logical
    expressions. The net effect is to combine the
    individual logical expressions into more complex
    conditions that are either true or false

7
Operators and expressions (Contd)
  • Any nonzero value, not just 1, is interpreted as
    true.
  • Logical and has higher precedence than logical or
  • Logical negation operator(!, a unary)
  • Assignment operators
  • Conditional operators
  • Library functions (abs, ceil, cos, floor, pow,

8
Operators and expressions (Contd)
  • Rand, sqrt, tolower, toupper )

9
Data Input and Output
  • Getchar(), putchar()
  • Scanf(),scanf(),scanf(3d), 3 is maximum
    field width
  • Long decimalld, long float or doublelf
  • Assignment suppression, d
  • Scanf(c1s1s,c1,c2,c3) or scanf(c c
    c)

10
Data Input and Output
  • Scanf(d a f)
  • Printf(), printf(3d), 3 is minmum field width
  • Printf(7.3f .1f)
  • Printf(-7.0f 7.0f-7.0f)
Write a Comment
User Comments (0)
About PowerShow.com