- Preprocessor can be redefined any where in the Program so that most recently assigned value will be taken.
- The scope of the labels is limited to functions.
- The case statement can have only constant expressions (this implies that we cannot use variable names directly). Enumerated types can be used in case statements.
- Scanf returns number of items successfully read.
- A variable is available for use from the point of declaration.
- Pointers give a facility to access the value of a variable indirectly.
- Prefix/postfix increment(++) and decrement(--) must be used with variables.
- Precedence is very important in writing a expression.
- Execution of preprocessor is separate from execution of compiler(Note: we can use any keywords and inbuilt function names).
- Every function name contains some address. So we can easily print that address using printf("%p",main);.
- Array names are pointer constants.
- Character constants are saved in code/data area but not in stack.
- g1##g2,Here g1 and g2 joined together.
- The default return value of a function is int. if it is not declared.
- printf can be implemented using variable length argument list.
- asserts are used during debugging to make sure that certain conditions are satisfied. If assertion fails, the program will terminate reporting the same. After debugging use, #undef NDEBUG and this will disable all the assertions from the source code. Assertion is a good debugging tool to make use of. if program terminates it shows <
> < > of the program. - stdin,stdout,stderr these three files are opened automatically when c program executes.
- SEEK_SET sets the file pointer to beginning of file.
- SEEK_CUR and SEEK_END are set accordingly by the name.
- if we want to read input between two quotation marks we should use scanf(" \"%[^\"]\"",s);.
- fgets always return a pointer,So while reading end of file it returns NULL pointer.
- If a program is continuously executed without any condition to terminate then its stack will filled completely and abnormally terminates.
- -1 is a boolean true value,Hence in if statement it executes next instruction of if.
- When two strings are placed together (or separated by white-space) they are concatenated (this is called as "stringization" operation).
- For array elements, consecutive memory locations are allocated.
- When a variable can be resolved by using multiple references, the local definition is given more preference.
- The variables in C can have static or automatic lifetimes.
- When a variable has a static lifetime, memory is allocated at the beginning of the program execution and it is reallocated only after the program terminates.
- When a variable has an automatic lifetime, the memory is allocated to the variable when the function is called and it is deallocated once the function completes its execution.
- Global variables have static lifetimes.
- By default, local variables have automatic lifetimes.
- To make a local variable static, use the storage-class specifier.
- Extern means that the variable or function is implemented elsewhere but is referred to in the current file.
- memory is allocated to the global variable at the beginning of the program execution.
- Register allocation is done for faster access, generally for loop counters.
- You cannot declare global register variables.
- The code between opening and closing curly brace called as block.
- Array elements are Homogeneous(means their elements are of same type).
- Structure elements are of Heterogeneous type (means their elements are of different type).
- Never compare or at-least be cautious when using floating point numbers with relational operators (== , >, <, <=, >=,!= ) .
Monday, March 16, 2009
Important facts in Writing a C Program
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment