0% found this document useful (0 votes)
71 views

Bool Datatype in C - Include Stdbool.h Header File

The document discusses C data types and storage classes. It provides examples of how static storage works in C by initializing a static array and copying strings to it. It also compares the differences between the postfix increment (++), prefix increment (++), and dereference (*) operators in C by showing how expressions like ++*p, *p++, and *++p are evaluated.

Uploaded by

Pallavi Vetal
Copyright
© © All Rights Reserved
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
71 views

Bool Datatype in C - Include Stdbool.h Header File

The document discusses C data types and storage classes. It provides examples of how static storage works in C by initializing a static array and copying strings to it. It also compares the differences between the postfix increment (++), prefix increment (++), and dereference (*) operators in C by showing how expressions like ++*p, *p++, and *++p are evaluated.

Uploaded by

Pallavi Vetal
Copyright
© © All Rights Reserved
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
You are on page 1/ 5

Bool datatype in C include stdbool.

h header file
Storage Class
In C, static variables can only be initialized using constant literals. This is allowed in C++ though.

Static Storage
strcpy(fun(),str) will cpy geeksforgeeks in static arr
next, base addrs of static arr will be assigned to str
next, strcpy(str,geeksquiz) will cpy geeksquiz to str which contains
base adds of arr.

Post incementing operator returns 0 on successfull operation and


pre incrementing operator returns 1
Difference between ++*p, *p++ and *++p

The expression ++*p has two operators of same precedence, so compiler looks for
assoiativity. Associativity of operators is right to left. Therefore the expression is treated as
++(*p). Therefore the output of first program is arr[0] = 11, arr[1] = 20, *p = 11.

The expression *p++ is treated as *(p++) as the precedence of postfix ++ is higher than *.
Therefore the output of second program is arr[0] = 10, arr[1] = 20, *p = 20.
The expression *++p has two operators of same precedence, so compiler looks for
assoiativity. Associativity of operators is right to left. Therefore the expression is treated as
*(++p). Therefore the output of second program is arr[0] = 10, arr[1] = 20, *p = 20.

You might also like