Thursday, 11 March 2010

How can we find the output of recursion program in quicker way in c?




How can we find the
output of recursion program in quicker way in c programming language


(1)What will be output of following c recursion program?




#include
int main(){

    int x,num=4;

    x=call(num);

    printf("%d",x);

    return 0;



}

int call(int num){

    static int x=1,y;

    if(num>0){

         x=x*num;

         y=call(num-1)+call(num-2);

    }

    return x;

Nesting of function call in C programming



Nesting of function call in c programming


If we are calling any function inside another function call is known as nesting
function call. Sometime it converts a difficult program in easy one.



For example:



Try to find out
maximum number among the five different integers without using nested function
call.







Find the maximum number among five different integers using
nested function

Function overloading in c


C doesn’t support function overloading. In c it is not possible to declare two function of same name but different signatures like number of parameters, data type of parameters, order of parameter etc.

For example:

int display(int x){

    return x;

}

int display(void){

    return 1;

}

void main(){

    int x,y;

    x=dispaly();

    y=display(1);

    printf("%d  %d",x,y);

    getch();

Tuesday, 26 January 2010

Switch case questions in c









C programming switch case questions and answers with
explanation 

1.

What will be output when you will execute following c code?

#include

void main(){

     int check=2;

     switch(check){

        case 1: printf("D.W.Steyn");

        case 2: printf(" M.G.Johnson");

        case 3:

Saturday, 23 January 2010

If else questions in c







If
else or control flow objective type questions and answers with explanation in c
language for written test or interview









1.








What will be output when you will execute following c code?











#include





void main(){





    int a=5,b=10,c=1;





    if(a&&b>c){





Sunday, 10 January 2010

C programming tutorials















INDEX
Chapter 1  Memory map
Chapter 2  Data type
Chapter 3  Variables in c
Chapter 4  Operators and expression
Chapter 5  Control structure if else and switch case

c questions asked in interview



C questions commonly or frequently asked in
interview



Check given number is prime number or not using

Check the given number is Armstrong number or not

Check the given number is palindrome number or not

Checking leap year

Check string is palindrome or not

Passing one-dimensional array to a function

Create a file and store data in it 

To passing 2-dimensional array to a function