Programming in C: Remember these points on constants.

A ‘long’ constant is written like 1234567697L or 567874338l. Big integer type constant is also taken as long. ‘unsigned’ constants written with a terminal u or U. ‘unsigned’ long type constants written with the terminal ul or UL. Floating point constants contain decimal point or an exponent (1e-1) or both. They are declared as ‘double’ type. The value of an integer can be specified as octal or hexadecimal. A leading zero on an integer constant means octal and a leading 0x or 0X means hexadecimal.

decimal : 31 octal : 031 hex : 0x1F

Character constants :

It is an integer. eg.’x’. A constant expression is an expression that involves only constants. They are used in any place where a constant occurs. A string constant or a string literal is a sequence of zero or more characters surrounded by double quotes.

In switch each case is labeled by integer valued constants or constant expressions. In the while and do loops ‘continue’ means that the test part is executed immediately. In for loop the control passes to the increment step. The continue statement applies only to loops not to ‘switch’.

Author: Abhilash

Hey! My name is Abhilash - A Ruby developer for years, specialised on web programming, working as a freelancer. Mainly working on Ruby On Rails platform since 2010. This blog is about Ruby, Ruby On Rails and other subjects that I work. You can contact me here: Abhilash AK

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s