Skip to main content

Posts

Showing posts from April, 2010

Why we use function in c

Function is much important when we have to do a long project. Let we have a math function (sum, sub,mul etc.) in our project we need the same calculation several times. if we have a function. We can do it by a single line (by calling the function). Otherwise we will have to rewrite the same code of calculation again. And function got arbitrarily long. Above this reason we use function in C program and we don’t write all codes in main () function.

Function prototype&Why need function prototype in mutual recursion.

Function prototype : A function prototype is a statement 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 identifies its bellow. Function prototypes are usually written at the beginning of a program, ahead of any programmer-defined functions. Why need function prototype in mutual recursion n: When two or more functions call one another it is called mutual recursion. Like under function:                                     Int a( ) { b( ) } Int b( { a( ) } Here (a) and (b) two function & process mutual recursion. Beginning at the program we need write a function prototype. Case here (b) can called (a) but (a) can’t call (b). In the beginning the program declared (a) integer type. So (b) can call (a), but (b) does not declare. So (a) can’t call

Precision of floating point number

Precision of floating point number: floating-point numbers cannot exactly represent all real numbers, and that floating-point operations cannot exactly represent right value. It’s return approximate digit. It is called Precision of floating point number. The precision of floating point number will vary from one version to another. Almost all version of the language allow at least six significant figures. i.e. 1.0 is a floating point number. It might be represented within the computer’s memory as 0.999999………, it is not accurate value of 1.0. However it might appear as 1.0

Properties of Array

Properties of Array are given bellow: A. All element of same size. B. All elements are of same type. C. All elements are stored in consecutive location. D. Array is a random access data stricture

Properties of Register value

Properties of Register value are given bellow: A. Register variable stored in register. B. Has initial garbage value. C. Register variable can only be declared as local. D. It is a requisite, not a must. E. It requisite is not granted if works only as a local variable. F. The access speed of a register variable is pretty fast.

Properties of Static variable

Properties of Static variable are given bellow: A. Stored in data segment. B. Has initial default value zero. C. Known within the function on layer it is declared. D. It can only as the program lives after it is declared

Properties of Local variable

Properties of Local variable are given bellow : A. Stored in stuck segment. B. Has initial default garbage value. C. Lives as long as the function or layer lives (life). D. Only known within the function or layer it is declared.

DIFFERENCE BETWEEN INTEGER AND FLOATING POINT DATA TYPE

Integer Floating point An integer is an integer valued number. A floating point is a decimal number that contains a decimal point or an exponent or both. Integer data type can be written in three deferent number systems: decimal, octal, and hexadecimal. Floating point data type can be written only decimal number system. Integer data types require memory 2 bytes. Floating point data types require memory 4 bytes. Any combination of digit from the set 0 through 9 consist Integer data type. A decimal or exponent must be present in floating point data type. Example : 1254,789 etc. Example: 3.2/9.58e*05 etc.

DIFFERENCE BETWEEN IDENTIFIER AND KEYWORD

Identifier keyword Identifiers are names that are given to various program elements, such as variable, function and arrays. C take some reserved word called keyword, they have predefine meaning in C. Identifiers consist of letters and digits. Keyword consist only letter. Identifier’s first character must be a letter. Keyword’s all character is letter. Identifiers Upper and lowercase letter is use. Keywords are all lowercase. Upper and lowercase are not equivalent. Upper and lowercase are also not equivalent. Like: X, sum_5, _weather etc. But 4 th is not identifier cause identifier first character must a letter. Like: auto, short, long etc.