DISHA NIRDESHAN

Enlightens your career

Wednesday, June 8, 2011

Basic Questions of C

 What are the features of C? or What is C language ? The features of 'C' language are:- 1) It is a modular language... i.e. A large problem can be divided into many sub problems(modules) and tnen can be solved individually... Finally with all the solutions ready one can integrate them and find the final solution to that so called large problem... c-can be used for systems programming and general purpose programs, applications of c-language unix operating system(kernal was implemented by c),games,device driver,editor,compiler very important of c-language is modularity.through which re-usability, What are the applications and advantages of C-language? 1.'C' is the only intermediate programming language in between low level and high level programming language. 2.All applications written...

Questions on Functions

What is modular programming? If a program is large, it is subdivided into a number of smaller programs that are called modules or subprograms. If a complex problem is solved using more modules, this approach is known as modular programming.         What are the advantages of the functions? - Debugging is easier - It is easier to understand the logic involved in the program - Testing is easier - Recursive call is possible - Irrelevant details in the user point of view are hidden in functions - Functions are helpful in generalizing the program       What is an argument ? differentiate between formal arguments and actual arguments? An argument is an entity used to pass the data from calling funtion to the called funtion. Formal arguments...

Other concepts

Is it better to use malloc() or calloc()? Both the malloc() and the calloc() functions are used to allocate dynamic memory. Each operates slightly different from the other. malloc() takes a size and returns a pointer to a chunk of memory at least that big: void *malloc( size_t size ); calloc() takes a number of elements, and the size of each, and returns a pointer to a chunk of memory at least big enough to hold them all: void *calloc( size_t numElements, size_t sizeOfElement ); There's one major difference and one minor difference between the two functions. The major difference is that malloc() doesn't initialize the allocated memory. The first time malloc() gives you a particular chunk of memory, the memory might be full of zeros. If memory has been allocated, freed, and reallocated,...

Differences among concepts

What is the difference between 'break' and 'continue' statements? Differences between 'break' and 'continue' statements: break continue 1. break is a keyword used to terminate the loop or exit from the block.The control jumps to next statement after the loop or block. 1. continue is a keyword used for skipping the current iteration and go to next iteration of the loop 2.Syntax: { Statement 1; Statement 2; Statement n; break; } 2.Syntax: { Statement 1; continue; Statement 2; } 3. break can be used with for, while, do- while, and switch statements.When break is used in nested loops i.e. within the inner most loop then only the innermost loop is terminated. 3. This...

Questions on Pointers

What is a pointer? A pointer is a special variable in C language meant just to store address of any other variable or function. Pointer variables unlike ordinary variables cannot be operated with all the arithmetic operations such as '*','%' operators. Are pointers integers? No, pointers are not integers.A pointer is an address.It is merely a positive number and not an integer.     How are pointer variables initialized? Pointer variable are initialized by one of the following two ways - Static memory allocation - Dynamic memory allocation What does it mean when a pointer is used in an if statement? Any time a pointer is used as a condition, it means "Is this a non-null pointer?" A pointer can be used in an if, while, for, or do/while statement, or in a conditional...

Questions on Variables and Arrays

  What is the difference between declaring a variable and defining a variable? Declaring a variable means describing its type to the compiler but not allocating any space for it. Defining a variable means declaring it and also allocating space to hold the variable. You can also initialize a variable at the time it is defined.   In C, what is the difference between a static variable and global variable? A static variable declared outside of any function is accessible only to all the functions defined in the same file (as the static variable). However, a global variable can be accessed by any function (including the ones from different files).   What is difference between for loop and while loop and do-while loop in C language? for loop: When it is desired to do...