Grab C in this Site
Saturday, 29 June 2013
escape sequence characters
- escape sequences are used in formatting input and output
- an escape sequences always begins with a backward slash and is followed character
- c supports some special escape sequence characters that are used to do special task
- these are also called as backslash characters
- some of the escape sequence characters are as follows:
character constant | meaning |
---|---|
\n | new line |
\b | backspace |
\t | horizontal tab |
\f | form feed |
\a | alert |
\r | carriage return |
\v | verticaltab |
\? | question mark |
\' | single quote |
\" | double quote |
\\ | backslash |
\0 | Null |
Monday, 24 June 2013
interger,floating point,character constants
interger constants:
integer constants take one of the following forms:
integer constants take one of the following forms:
- a decimal number e.g 1,123,100002.
- an octal number e.g.,01,01273,0303242.anoctal constant is introduced by a leading 0 and the digits are 0 through 7
- a hexadecimal number e.g.,0X1,0X7b,0X186A2.a hex constant is introduced by a leading 0Xor 0x and the digits are 0 trough 9 followed by a through F
- a character constant
floating point constants take one of the following forms:
- a decimal number followed by a decimal point followed by another decimal number e.g.,1.0,1.9993,3.42
- a number like the previous but with an exponent part i.e an e or E followed by a decimal number e.g 1.0e10,1.23e-2,1.00e+2
- A character constant is a character enclosed in single quotes e.g, 'a','2'
- in a character constant a backslash character is treated specially it introduces an escape sequence
- these escape sequences are usually used to represent characters that are not easy to see when represented by themselves or need to be escaped for syntax reason
Sunday, 23 June 2013
syntax of variable
syntax:
datatype v1,v2,v3....... |
---|
- datatype refers to the type of the data i.e integer,float,character,double.....
- v1,v2,v3...are the names of the variables variables are seperated by commas
- a declaration statement end with semicolon
- declaration of the variable is usually done immediately after the opening brace of the pgm
- the variable can also be declared out side(either before or after) the main function
Saturday, 22 June 2013
variable
- an identifier whose value is allowed to change during the creation of a program is called variable
- every variable must be individually declared before it can appear in the program
- the variable declaration establishes the fact the the identifier is a variable and specifies the type of variable
- a variable name is any combination of 1 to 8 alphabets,digits,or underscores
- the first character in the variable name must be alphabet
- no commas or blanks are allowed within the variable name
- on special symbol other than an under score can be used in a variable name
- ex:si ine ,area,radius,marks1,sub marks
identifiers
identifiers
- identifiers are the names used for variables.types function and label in program
- they must differ in spelling and case from the keywords
- these are created by specifying it in the declaration of a variable type or function
- first character must be alphabet
- must consists of only letters,digit,underscore
- only first 31 characters are significant
- cannot use a keyword
- must not contain white space
Subscribe to:
Posts (Atom)