Professional Documents
Culture Documents
Well, its neither!!! Actually C is a mixture of both How??? C supports High Level Language features like easy syntax, branching, looping, arrays, structures and also has pointers, memory allocation methods which are Low Level Language features. So, C is a High Level Language with Low Level features or a Mid Level Language.
Type modifiers are some keywords used along with variable declaration to change the inherent nature of the variables i.e. the modifiers are used to vary the sizes of the variables. Keywords used as type modifiers are: [UL] short[/UL] [UL] long [/UL] [UL] signed [/UL] [UL] unsigned[/UL]
3.What does Storage Class of a variable suggest? What are the types of Storage Class?
It suggests: [UL] where the variable will be stored [/UL] [UL] what will be the initial value of the variable, if the default initial value is not specified [/UL]
[UL] what is the scope of the variable i.e. in which functions the value of the variable would be available. [/UL] [UL] what is the life of the variable, i.e. how long the variable would exist. [/UL] There are four storage classes in C: [UL] Automatic storage class[/UL] [UL] Register storage class [/UL] [UL]Static storage class[/UL] [UL] External storage class [/UL]
4.Find the output for the following C program main() { int x=20,y=35; x = y++ + x++; y = ++y + ++x; printf ("%d %d \n", x, y); }
Ans. 57 94
Answer: Linker Error : Undefined symbol i Extern storage class in the following declaration, extern int i; specifies to the compiler that the memory for i is allocated in some other program and that address will be given to the current program at the time of linking. But linker finds that no other variable of
name i is available in any other program with memory space allocated for it. Hence a linker error has occurred .
6. What will be output of following code? void main() { char a[5]; a[0]='q'; a[1]='u'; a[2]='e'; clrscr(); printf ("%s", a); getch(); }
Answer: Output: garbage Explanation: %s is used for string but a is not a string it is only array of character since its last character is not null character. If you will write a[3]=\0; then output will be que.
7. What is the output of the following code:void main() { int i; for(i=0;i<3;i++) { int i=100; i--; printf ("%d.. ",i); } } (a)0..1..2.. (b)99..98..97.. (c)100..100..100.. (d)99..99..99..
Answer: d
#include
OR
int main(int argc, char * argv[]) { } argc is the number of arguments stated in the command line. Use argv[0] to get the program (process) name Use argv[1],, to argv[argc-1] to get the command lines.
OR