Tough c interview questions


Tough c interview questions and answer with explanation
1
What is pascal and cdecl keyword in c language? Or
What are the parameter passing conventions in c?
Answer
Explanation:
There are two types of parameters passing conventions in c:
1. pascal: In this style function name should (not necessary ) in the uppercase .First parameter of function call is passed to the first parameter of function definition and so on. 
2. cdecl: In this style function name can be both in the upper case or lower case. First parameter of function call is passed to the last parameter of function definition. It is default parameter passing convention.
Examples: 
1. What will be output of following program?

#include<stdio.h>
int main(){
static int a=25;
void cdecl conv1() ;
void pascal conv2();
conv1(a);
conv2(a);
return 0;
}
void cdecl conv1(int a,int b){
printf("%d %d",a,b);
}
void pascal conv2(int a,int b){
printf("\n%d %d",a,b);
}

Output: 25 0
0 25

(2) what will be output of following program?

#include<stdio.h>
void cdecl fun1(int,int);
void pascal fun2(int,int);
int main(){
    int a=5,b=5;
    fun1(a,++a);
    fun2(b,++b);
    return 0;
}
void cdecl fun1(int p,int q){
    printf("cdecl:  %d %d \n",p,q);
}
void pascal fun2(int p,int q){
    printf("pascal: %d %d",p,q);
}
Output:
cdecl:  6 6
pascal: 5 6
(3) What will be output of following program?

#include<stdio.h>
void cdecl fun1(int,int);
void pascal fun2(int,int);
int main(){
    int a=5,b=5;
    fun1(a,++a);
    fun2(b,++b);
    return 0;
}
void cdecl fun1(int p,int q){
    printf("cdecl:  %d %d \n",p,q);
}
void pascal fun2(int p,int q){
    printf("pascal: %d %d",p,q);
}
Output:
cdecl:  6 6
pascal: 5 6
(4) What will be output of following program?

#include<stdio.h>
void convention(int,int,int);
int main(){
    int a=5;
    convention(a,++a,a++);
    return 0;
}
void  convention(int p,int q,int r){
    printf("%d %d %d",p,q,r);
}
Output: 7 7 5
(5) What will be output of following program?

#include<stdio.h>
void pascal convention(int,int,int);
int main(){
    int a=5;
    convention(a,++a,a++);
    return 0;
}
void pascal  convention(int p,int q,int r){
    printf("%d %d %d",p,q,r);
}
Output: 5 6 6
(6) What will be output of following program?

#include<stdio.h>
void pascal convention(int,int);
int main(){
    int a=1;
    convention(a,++a);
    return 0;
}
void pascal  convention(int a,int b){
    printf("%d %d",a,b);
}
Output: 1 2
(7) What will be output of following program?

#include<stdio.h>
void convention(int,int);
int main(){
    int a=1;
    convention(a,++a);
    return 0;
}
void convention(int a,int b){
    printf("%d %d",a,b);
}
Output: 2 2
Hide
2
Can you declare such function which return type is pointer to a structure?
Answer
Explanation:
#include <stdio.h>
typedef struct film{
    int size;
    int pixel;
    float price;
}xyz,pqr;

struct film *jadu(){
    static xyz one={231,12,900.0},*p=&one;
    return p;
}

int main(){
    pqr *ptr;
    ptr=jadu();
    printf("%d",ptr->pixel);
    return 0;
}

Output: 12
Hide
3
Can you write a c code to create dos command like dir?
Answer
Explanation:
Step 1: Write following code.

#include <stdio.h>
#include <dos.h>
int main(int count,char *argv[]){
struct find_t q ;
    int a;
    if(count==1)
         argv[1]="*.*";
         a = _dos_findfirst(argv[1],1,&q);
    if(a==0){
         while (!a){
             printf("  %s\n", q.name);
             a = _dos_findnext(&q);
         }
    }
    else{
        printf("File not found");
    }
return 0;   
}

Step 2: Save the as open.c (You can give any name)
Step 3: Compile and execute the file.
Step 4: Write click on My computer of Window XP operating system and select properties.
Step 5: Select Advanced -> Environment Variables
Step 6: You will find following window:

Click on new button (Button inside the red box)


Step 7: Write following:
Variable name: path
Variable value: c:\tc\bin\open.c  (the path where you have saved)

Step 8: Open command prompt and write list and press enter button.
Hide
4
Write a c program which restricts the movement of pointer?
Answer
Explanation:
//restrict the x and y coordinate
#include <dos.h>
#include <stdio.h>
int main(){

union REGS i,o;

//show mouse pointer
i.x.ax=1;
int86(0x33,&i,&o);

//x coordinate restriction
i.x.ax=7;
i.x.cx=20;
i.x.dx=300;
int86(0x33,&i,&o);

//y coordinate restriction
i.x.ax=8;
i.x.cx=50;
i.x.dx=250;
int86(0x33,&i,&o);
return 0;
}
Hide
5
What is use of #pragma inline directive in c language?
Answer
Explanation:
#pragma inline only tells the compiler that source code of program contain inline assembly language code .In c we can write assembly language program with help of asm keyword.
Hide
6
How much are you comfortable with complex pointer declaration in c?
Answer
Explanation:
Rule 1. Assign the priority to the pointer declaration considering precedence and associative according to following table.
Where
(): This operator behaves as bracket operator or function operator.
[]: This operator behaves as array subscription operator.
*: This operator behaves as pointer operator not as multiplication operator.
Identifier: It is not an operator but it is name of pointer variable. You will always find the first priority will be assigned to the name of pointer.
Data type: It is also not an operator. Data types also includes modifier (like signed int, long double etc.)
You will understand it better by examples:
(1) How to read following pointer?
char (* ptr)[3]
Answer:
Step 1: () and [] enjoys equal precedence. So rule of associative will decide the priority. Its associative is left to right So first priority goes to ().

Step 2: Inside the bracket * and ptr enjoy equal precedence. From rule of associative (right to left) first priority goes to ptr and second priority goes to *.

Step3: Assign third priority to [].

Step4: Since data type enjoys least priority so assign fourth priority to char.

Now read it following manner:
ptr is pointer to such one dimensional array of size three which content char type data. 
(2) How to read following pointer?
float (* ptr)(int)
Answer:
Assign the priority considering precedence and associative
Now read it following manner:
ptr is pointer to such function whose parameter is int type data and return type is float type data.
Rule 2: Assign the priority of each function parameter separately and read it also separately. Understand it through following example.
(3) How to read following pointer?
void (*ptr)(int (*)[2],int (*) void))
Answer:
Assign the priority considering rule of precedence and associative.

Now read it following manner:

ptr is pointer to such function which first parameter is pointer to one dimensional array of size two which content int type data and second parameter is pointer to such function which parameter is void and return type is int data type and return type is void
(4) How to read following pointer?
int ( * ( * ptr ) [ 5 ] ) ( )
Answer:
Assign the priority considering rule of precedence and associative.

Now read it following manner:
ptr is pointer to such array of size five which content are pointerto such function which parameter is void and return type is int type data.
(5) How to read following pointer?
double*(*(*ptr)(int))(double **,char c)
Answer:
Assign the priority considering rule of precedence and associative.

Now read it following manner:
ptr is pointer to function which parameter is int type data and return type is pointer to function which first parameter is pointer to pointer of double data type and second parameter is char type data type and return type is pointer to double data type.
(6) How to read following pointer?
unsigned **(*(*ptr)[8](char const *, ...)
Answer:
Assign the priority considering rule of precedence and associative.

Now read it following manner:
ptr is pointer to array of size eight and content of array ispointer to function which first parameter is pointer to character constant and second parameter is variable number of arguments and return type is pointer to pointer of unsigned int data type.
Hide
7
What is the meaning of multilevel pointers in c?
Answer
Explanation:
A pointer is pointer to another pointer which can be pointer to others pointers and so on is known as multilevel pointers. We can have any level of pointers. Examples of multilevel pointers in c:
What will be output if you will execute following code?

#include<stdio.h>
int main(){
int s=2,*r=&s,**q=&r,***p=&q;
printf("%d",p[0][0][0]);
return 0;
}
Output: 2
Explanation: 
As we know p[i] =*(p+i)
So, P[0][0][0]=*(p[0][0]+0)=**p[0]=***p
Another rule is: *&i=i
So, ***p=*** (&q) =**q=** (&r) =*r=*(&s) =s=2

What will be output if you will execute following code?

#include<stdio.h>
#define int int*
int main(){
    int *p,q;
p=(int *)5;
q=10;
printf("%d",q+p);
return 0;
}
Output: 25
Explanation: 
If you will see intermediate file you will find following code:

#include<stdio.h>
void main(){
int **p,q;
p=(int **)5;
q=10;
printf("%d",q+p);
return 0;
}

Explanations:
Here q pointer and p is a number.
In c, Address + number = Address
So, New address = old address + number * Size of data type to which pointer is pointing.
= 5 + 10 * sizeof (*int)
= 5+10*2 = 25.
Note. We are assuming default pointer is near. Actually it depends upon memory model.
Hide
8
Are you familiar with memory model in turbo c?
Answer
Explanation:
In c there are six type of memory model. If you want to see all memory model in Turbo C++ IDE then open Turbo C++ IDE and the go: Options menu -> Compiler -> Code generation

These memory models are:
(a) TINY
(b) SMALL
(c) MEDIUM
(d) COMPACT
(e) LARGE
(f) HUGE
If you want to change the memory model then go to: Options menu -> Compiler -> Code generation
And select any memory model and click OK button.
Properties of memory mode in C:
(1) Memory model decides the default type of pointer in C.
Note: Code: A pointer to function is called code.
Data: A pointer to variable is called data.
Examples:
What will be output of following c program?

#include<stdio.h>
int main(){
int *ptr;
printf("%d",sizeof ptr);
return 0;
}
Output: Depends upon memory model.
Explanation: If memory model is TINY, SMALL or MEDIUM then default pointer will near and output will be 2 other wise output will be 4.
(2)What will be output of following c program?

#include<stdio.h>
int main(){
char (*fun)();
printf("%d",sizeof fun);
return 0;
}
Output: Depends upon memory model.
Explanation: fun is pointer to function. If memory model is TINY, SMALL or COMPACT then default pointer will near and output will be 2 other wise output will be 4.
(3)What will be output of following c program?

#include<stdio.h>
int main(){
int near *p,*q;
printf("%d , %d",sizeof(p),sizeof(q));
return 0;
}
Output: 2, Depend upon memory model.
Explanation: p is near pointer while type of pointer q will depend what is default type of pointer.
(4)What will be output of following c program?

#include<stdio.h>
int main(){
char huge **p;
printf("%d , %d",sizeof(p),sizeof(*p));
return 0;
}
Output: 4, Depend upon memory model.
Explanation: p is huge pointer while type of pointer *p will depend what is default type of pointer.

(5)Write a c program to find the memory model of you computer?

#include<stdio.h>
int main(){
   #if defined __TINY__
   printf("Memory model is: TINY");
   #elif defined __SMALL__
   printf("Memory model is:SMALL ");
   #elif defined __MEDIUM__
   printf("Memory model is:MEDIUM ");
   #elif defined __COMPACT__
   printf("Memory model is:COMPACT ");
   #elif defined __LARGE__
   printf("Memory model is:LARGE ");
   #elif defined __HUGE__
   printf("Memory model is:HUGE ");
   #endif
   return 0;
}
Hide
9
What is far pointer in c?
Answer
Explanation:
The pointer which can point or access whole the residence memory of RAM i.e. which can access all 16 segments is known as far pointer.
Size of far pointer is 4 byte or 32 bit. Examples:
(1) What will be output of following c program?

#include<stdio.h>
int main(){
int x=10;
int far *ptr;
ptr=&x;
printf("%d",sizeof ptr);
return 0;
}
Output: 4
(2)What will be output of following c program?

#include<stdio.h>
int main(){
int far *near*ptr;
printf("%d %d",sizeof(ptr) ,sizeof(*ptr));
return 0;
}
Output: 4 2
Explanation: ptr is far pointer while *ptr is near pointer.
(3)What will be output of following c program?

#include<stdio.h>
int main(){
int far *p,far *q;
printf("%d %d",sizeof(p) ,sizeof(q));
return 0;
}
Output: 4 4
First 16 bit stores: Segment number and next 16 bit stores: Offset address
What is segment number and offset address?

#include<stdio.h>
int main(){
int x=100;
int far *ptr;
ptr=&x;
printf("%Fp",ptr);
return 0;
}
Output: 8FD8:FFF4
Here 8FD8 is segment address and FFF4 is offset address in hexadecimal number format.
Note: %Fp is used for print offset and segment address of pointer in printf function in hexadecimal number format. In the header file dos.h there are three macro functions to get the offset address and segment address from far pointer and vice versa.
1. FP_OFF(): To get offset address from far address.
2. FP_SEG(): To get segment address from far address.
3. MK_FP(): To make far address from segment and offset address. Examples:
(1)What will be output of following c program?
#include <dos.h>
#include<stdio.h>
int main(){
int i=25;
int far*ptr=&i;
printf("%X %X",FP_SEG(ptr),FP_OFF(ptr));
return 0;
}
Output: Any segment and offset address in hexadecimal number format respectively.
(2)What will be output of following c program?
#include <dos.h>
#include<stdio.h>
int main(){
int i=25;
int far*ptr=&i;
unsigned int s,o;
s=FP_SEG(ptr);
o=FP_OFF(ptr);
printf("%Fp",MK_FP(s,o));
return 0;
}
Output: 8FD9:FFF4 (Assume)
Note: We cannot guess what will be offset address; segment address and far address of any far pointer .These address are decided by operating system.
Limitation of far pointer:
We cannot change or modify the segment address of given far address by applying any arithmetic operation on it. That is by using arithmetic operator we cannot jump from one segment to other segment. If you will increment the far address beyond the maximum value of its offset address instead of incrementing segment address it will repeat its offset address in cyclic order. Example:

(q)What will be output of following c program?

#include<stdio.h>
int main(){
int i;
char far *ptr=(char *)0xB800FFFA;
for(i=0;i<=10;i++){
printf("%Fp \n",ptr);
ptr++;
}
return 0;
}
Output:
B800:FFFA
B800:FFFB
B800:FFFC
B800:FFFD
B800:FFFE
B800:FFFF
B800:0000
B800:0001
B800:0002
B800:0003
B800:0004
This property of far pointer is called cyclic nature of far pointer within same segment.
Important points about far pointer:
1. Far pointer compares both offset address and segment address with relational operators. Examples:

#include<stdio.h>
int main(){
int far *p=(int *)0X70230000;
int far *q=(int *)0XB0210000;
if(p==q)
printf("Both pointers are equal");
else
printf("Both pointers are not equal");
    return 0;
}
Output: Both pointers are not equal
(2)What will be output of following c program?

#include<stdio.h>
int main(){
int far *p=(int *)0X70230000;
int far *q=(int *)0XB0210000;
int near *x,near*y;
x=(int near *)p;
y=(int near *)q;
if(x==y)
printf("Both pointer are equal");
else
printf("Both pointer are not equal");
    
    return 0;
}
Output: Both pointers are equal
2. Far pointer doesn’t normalize.
Hide
10
Can you explain pointer to array of union in c?
Answer
Explanation:
A pointer to an array which contents is pointer to union is known as pointer to array of union.
What will be output if you will execute following code?
union emp{
char *name;
int id;
};
int main(){
static union emp e1={"A"},e2={"B"},e3={"C"};
union emp(*array[])={&e1,&e2,&e3};
union emp(*(*ptr)[3])=&array;
printf("%s ",(*(*ptr+2))->name);
return 0;
}
Output: C
Explanation:
In this example:
e1, e2, e3: They are variables of union emp.
array []:It is one dimensional array of size thee and its content are address of union emp.
ptr: It is pointer to array of union. 
(*(*ptr+2))->name
=(*(*&array+2))->name //ptr=&array
=(*(array+2))->name //from rule *&p=p
=array[2]->name //from rule *(p+i)=p[i]
=(&e3)->name //array[2]=&e3
=*(&e3).name //from rule ->= (*).
=e3.name //from rule *&p=p
=”C”
Hide
11
Can you declare pointer to array of pointer to string in c?
Answer
Explanation:
Pointer to array of pointer to string: A pointer to an array which contents are pointer to string. Example of Pointer to array of pointer to string:

#include<stdio.h>
int main(){
static char *s[3]={"math","phy","che"};
typedef char *( *ppp)[3];
static ppp p1=&s,p2=&s,p3=&s;
char * (*(*array[3]))[3]={&p1,&p2,&p3};
char * (*(*(*ptr)[3]))[3]=&array;
p2+=1;
p3+=2;
printf("%s",(***ptr[0])[2]);
return 0;
}
Output: che
Explanation: 
ptr: is pointer to array of pointer to string.
P1, p2, p3: are pointers to array of string.
array[3]: is array which contain pointer to array of string.
Pictorial representation:
Note: In the above figure upper part of box represent content and lower part represent memory address. We have assumed arbitrary address.
As we know p[i]=*(p+i)
(***ptr[0])[2]=(*(***ptr+0))[2]=(***ptr)[2]
=(***(&array))[2] //ptr=&array
=(**array)[2] //From rule *&p=p
=(**(&p1))[2] //array=&p1
=(*p1)[2]
=(*&s)[2] //p1=&s
=s[2]=”che”
Hide
12
What is extern keyword in c?
Answer
Explanation:
Keyword extern is used for declaring extern variables in c. This modifier is used with all data types like int, float, double, array, pointer, structure, function etc.

Important points about extern keyword:

1. It is default storage class of all global variables as well all functions. For example, Analyze following two c code and its output:

(a)
#include <stdio.h>
int i;    //By default it is extern variable
int main(){
    printf("%d",i);
    return 0;
}

Output: 0

(b)
#include <stdio.h>
extern int i;    //extern variable
int main(){
    printf("%d",i);
    return 0;
}

Output: Compilation error, undefined symbol i.

Question: In Both program variable i is extern variable. But why output is different? Read second and third points.

(c)
#include <stdio.h>
void sum(int,int//By default it is extern.
int main(){
    int a=5,b=10;
    sum(a,b);
    return 0;
}
void sum(int a,int b){
    printf("%d”",a+b);
}

Output: 15

2. When we use extern modifier with any variables it is only declaration i.e. memory is not allocated for these variable. Hence in second case compiler is showing error unknown symbol i. To define a variable i.e. allocate the memory for extern variables it is necessary to initialize the variables. For example:

#include <stdio.h>
extern int i=10;    //extern variable
int main(){
    printf("%d",i);
    return 0;
}

Output: 10

3. If you will not use extern keyword with global variables then compiler will automatically initialize with default value to extern variable.

4. Default initial value of extern integral type variable is zero otherwise null. For example:

#include <stdio.h>
char c;
int i;
float f;
char *str;  
int main(){
    printf("%d %d %f %s",c,i,f,str);
    return 0;
}

Output: 0 0 0.000000 (null)

5. We cannot initialize extern variable locally i.e. within any block either at the time of declaration or separately. We can only initialize extern variable globally. For example:

(a)
#include <stdio.h>
int main(){
extern int i=10; //Try to initialize extern variable
                 //locally.
    printf("%d",i);
    return 0;
}
Output: Compilation error: Cannot initialize extern variable.

(b)
#include <stdio.h>
int main(){
    extern int i; //Declaration of extern variable i.
    int i=10;     //Try to locally initialization of
                  //extern variable i.
    printf("%d",i);
    return 0;
}

Output: Compilation error: Multiple declaration of variable i.

6. If we declare any variable as extern variable then it searches that variable either it has been initialized or not. If it has been initialized which may be either extern or static* then it is ok otherwise compiler will show an error. For example:

(a)
#include <stdio.h>
int main(){
    extern int i; //It will search the initialization of
                  //variable i.
    printf("%d",i);
    return 0;
}
int i=20;    //Initialization of variable i.

Output: 20

(b)
#include <stdio.h>
int main(){
extern int i; //It will search the any initialized
              //variable i which may be static or 
              //extern.
printf("%d",i);
    return 0;
}
extern int i=20; //Initialization of extern variable i.

Output: 20

(c)
#include <stdio.h>
int main(){
extern int i; //It will search the any initialized
              //variable i which may be static or 
              //extern.
    printf("%d",i);
    return 0;
}
static int i=20; //Initialization of static variable i.

Output: 20

(d)
#include <stdio.h>
int main(){
    extern int i;   //variable i has declared but not
                    //initialized
    printf("%d",i);
    return 0;
}

Output: Compilation error: Unknown symbol i.

7. A particular extern variable can be declared many times but we can initialize at only one time. For example:

(a)
extern int i; //Declaring the variable i.
int i=25;     //Initializing the variable.
extern int i; //Again declaring the variable i.
#include <stdio.h>
int main(){
    extern int i; //Again declaring the variable i.
    printf("%d",i);
    return 0;
}

Output: 25

(b)
extern int i; //Declaring the variable
int i=25;     //Initializing the variable
#include <stdio.h>
int main(){
         printf("%d",i);
    return 0;
}
int i=20; //Initializing the variable

Output: Compilation error: Multiple initialization variable i.

8. We cannot write any assignment statement globally. For example:

#include <stdio.h>
extern int i;
int i=10;   //Initialization statement
i=25;       //Assignment statement
int main(){
    printf("%d",i);
    return 0;
}

Output: Compilation error

Assigning any value to the variable at the time of declaration is known as initialization while assigning any value to variable not at the time of declaration is known assignment.

(b)
#include <stdio.h>
extern int i;
int main(){
    i=25;       //Assignment statement
    printf("%d",i);
    return 0;
}
int i=10;   //Initialization statement

Output: 25

9. If declared an extern variables or function globally then its visibility will whole the program which may contain one file or many files. For example consider a c program which has written in two files named as one.c and two.c:

(a)
//one.c
#include<conio.h>
int i=25; //By default extern variable
int j=5;  //By default extern variable
/**
Above two lines is initialization of variable i and j.
*/
void main(){
    clrscr();
    sum();
    getch();
}

//two.c
#include<stdio.h>
extern int i; //Declaration of variable i.
extern int j; //Declaration of variable j.
/**
Above two lines will search the initialization statement of variable i and j either in two.c (if initialized variable is static or extern) or one.c (if initialized variable is extern) 
*/
void sum(){
    int s;
    s=i+j;
    printf("%d",s);
}

Compile and execute above two file one.c and two.c at the same time:

In Turbo c compiler

Step 1: Write above two codes in the file named as one.c and two.c (You can give any name as you like) and save it.

Step 2: In Turbo c++ IDE click on Project -> Open project menu as shown in following screen dump:

Step 3: After Clicking on open project you will get following screen:

In Open project File text field write any project name with .prj extension. In this example I am writing project name as CProject.PRJ. Now press OK button.

Step 4: After pressing OK button you will get following screen:

Now click on Project -> Add item menu.

Step 5: After clicking Add item you will get following screen:

In the name text field write down all c source code file one by one i.e. first write one.c and click on Add button then write two.c and click on Add button and so on

Step 6: At the end click on Done button. After clicking on done button you will get following screen:

At the lower part of window you can see project name, list of files you have added etc.
Step7: To compile the two files press Alt+F9 and to run the above program press Ctrl+F9

Note: To close the project click on Project -> Close project.

Output: 30

Hence we can say variable i and j which has initialized into two.c is also visible in file one.c. This example proves visibility of globally declared extern variable is program.

Note: In the above example function sum which was declared and defined in two.c has also storage class extern. So we can call from other file (one.c).If it will static then we cannot call function sum since static storage class is only visible to the file where it has declared.

10. An extern variables or functions have external linkage. An external linkage variables or functions are visible to all files.  
Hide
13
Why we use volatile variables in c?
Answer
Explanation:
All variable in c are by default not volatile. With help of modifier volatile which is keyword of c language you can make any variable as volatile variable.

Properties of volatile variable:

1. A volatile variable can be changed by the background routine of preprocessor. This background routine may be interrupt signals by microprocessor, threads, real times clocks etc.

2. In simple word we can say a value volatile variable which has stored in the memory can be by any external sources.

3. Whenever compiler encounter any reference of volatile variable is always load the value of variable from memory so that if any external source has modified the value in the memory complier will get its updated value.

4. Working principle of volatile variable is opposite to the register variable in c. Hence volatile variables take more execution time than non-volatile variables.

A volatile variable is declared with help of keyword volatile:

int volatile i;

A non-volatile variable is declared without using keyword volatile:

int i;

Question: What is meaning of following declaration in c?

const volatile float f;
register volatile char c;
Hide
14
What is the segmentation in operating system?
Answer
Explanation:
Residential memory of RAM of size 1MB has divided into 16 equal parts. These parts is called segment. Each segment has size is 64 KB.

16 * 64 KB = 1 MB

This process of division is known as segmentation.

Note: In turbo c 3.0 physical addresses of any variables are stored in the 20 bits. But we have not any pointers of size 20 bits. So pointers cannot access whole residence memory address. To solve this problem we there are three types pointers in c language. They are:
1. Near pointer
2. Far pointer
3. Huge pointer
Hide
15
Can you write a function which returns an integer without using return keyword in turbo c?
Answer
Explanation:
#include <stdio.h>
int fun();
int main(int argc, char *argv[]){
    printf("%d",fun());
    return 0;
}
int fun(){
    _AX = 5;
}
Hide

4 comments:

AnotherBlogger said...

Hi,

Please elaborate the answer of the question 7.

Regards,
Anand

A to Z tricks said...

Very Good solving for Interviews

Unknown said...

Plaese give correct explanation of question 15 plzzz

Unknown said...

Please Correct 6th example of Question 6

given :
unsigned **(*(*ptr)[8](char const *, ...)

correct :
unsigned **( *(*ptr)[8] ) (char const *, ...)
')' is missing after [8]