0% found this document useful (0 votes)
46 views2 pages

Declarations and Initializations

This document discusses C data types and declarations. It notes that C data types can be primary (int, char, float, etc.) or secondary/user-defined (arrays, pointers, structures, unions, enums). It provides details on size of specific data types like float, double, short int and long int. It explains the differences between declarations and definitions, and between arguments and parameters. The document also covers function prototypes, expressions and their order of precedence, strings and common string functions.

Uploaded by

Ankita Sukede
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
46 views2 pages

Declarations and Initializations

This document discusses C data types and declarations. It notes that C data types can be primary (int, char, float, etc.) or secondary/user-defined (arrays, pointers, structures, unions, enums). It provides details on size of specific data types like float, double, short int and long int. It explains the differences between declarations and definitions, and between arguments and parameters. The document also covers function prototypes, expressions and their order of precedence, strings and common string functions.

Uploaded by

Ankita Sukede
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

DECLARATIONS AND INITIALIZATIONS

C data types classification are


1.Primary data types
int
char
float
double
void
2.Secondary data types (or) User-defined data type
Array
Pointer
Structure
Union
Enum

 Float-4 bytes
• Double-8 bytes
• Long double-10 bytes
 Short int -2BYTES
 Long int –4bytes
 declaration of variable is called forward referencing
 extern int x; - is an external variable declaration.
 double pow(double, double); - is a function prototype declaration.
 loat square ( float x ) { ... } -is definition.
 During declaration we tell the datatype of the Variable.
 During definition the value is initialized.
 An argument in context with functions is the actual value that is passed to the function ( as input)
,when it is called.
 However parameter refers to the variables that are used in the function declaration/definition to
represent those arguments that were send to the function during the function call.
 A function prototype in C or C++ is a declaration of a function that omits the function body but does
specify the function's name, argument types and return type.
 While a function definition specifies what a function does, a function prototype can be thought of as
specifying its interface.
 enum takes the format like {0,1,2..)
 whenever there is a conflict between local variable and global variable, local variable gets the highest
priority.
 Any pointer size is 2 bytes. (only 16-bit offset)
So, char *s1 = 2 bytes.
So, char far *s2; = 4 bytes.
So, char huge *s3; = 4 bytes.
A far, huge pointer has two parts: a 16-bit segment value and a 16-bit offset value.
 Since C is a compiler dependent language, it may give different output in other platforms.
 The modulus (%) operator can only be used on integer types.
 We have to use fmod() function in math.h for float values.
 6.68 is double.
6.68L is long double constant.
6.68f is float constant.
6.68LF is not allowed in c.
 The range of double is -1.7e+308 to 1.7e+308.
 Depending on the operating system/compiler/system architecture you are working on, the
range of data types can vary.
 The range of float is -3.4e+38 to 3.4e+38.

EXPRESSIONS

 Order of precedence(top to bottom)


Arithmetic operators: *, /, %, +, -
Relational operators: >, <, >=, <=, ==, !=
Logical operators : !, &&, ||
Assignment operators: =

STRINGS

 The strcmp return an int value that is


 if s1 < s2 returns a value < 0
 if s1 == s2 returns 0
 if s1 > s2 returns a value > 0
 The function strstr() Finds the first occurrence of a substring in another string
 The library function used to find the last occurrence of a character in a string is strrchr()
 The statement printf("\\n"); prints '\n' on the screen.

You might also like