You are on page 1of 12

Fundamentals of C-Program

Data Types

Primary / Built in Secondary or derived


User defined DT DT
DT

. int
. structure . char . pointer
. union . float . array
. enum . double . function
. class . void
• Constants and Variable

int Age = 20
Types of C – Constants :

• Integer constants

• Real or Floating point constants

• Octal & Hexadecimal constants

• Character constants

• String constants

• Backslash character constants Escape Sequence

• https://fresh2refresh.com/c-programming/c-constants/
• 1.

• 1.Arithmetic Operators 2. Relational Operators 3. Logical Operators

• 4. Assignment Operators 5. Increment and Decrement Operators 6. Conditional Operator

• 7. Bitwise Operators 8. Special Operator


Expression :

 a x b – c  a * b – c

 (m + n) (x + y)  (m + n) * (x + y)

 (ab / c)  a * b / c

 3x2 +2x + 1  3*x*x+2*x+1

 (x / y) + c  x / y + c
Array

Function fundamentals
Basic of Input /Output Formatted / Unformatted

Formatted I/O:
Format specifiers in console formatted I/O functions
 scan f
%d Scan or print an integer
 printf as signed decimal
number
%f Scan or print a floating
point number
%c To scan or print a
character
%s To scan or print a
character string. The
scanning ends at
whitespace.
Unformatted I/O:

Reads a single string entered


Reads a single character from
getch() gets() by the user at the console.
the user at the
console, without echoing it.

Reads a single character from Displays a single string's value


the user at the console, and puts() at the console.
getche()
echoing it.

Displays a single character


Reads a single character from
putch() value at the console.
the user at the console, and
echoing it, but needs
getchar()
an Enter key to be pressed at
the end.
putchar() Displays a single character
value at the console.
There are four kinds of modifiers:

1.Signed

2.Unsigned

3.Short

4.Long

https://www.tutorialcup.com/cplusplus/modifier-types.htm
Storage class specifiers

 Auto - Variable

 Register
 Extern - Function
 Static - Declared outside

http://cs-fundamentals.com/c-programming/storage-classes-in-c-and-storage-class-
specifiers.php
Explicit type

1.int a=42;
2.float b=a;

1.float a=42.12;
2.int b=(int)a;

You might also like