Pointer interview questions in c

Pointer interview questions and answer in c programming language

1. What is wild pointer?
7. What are demerits of pointers?


  1. answers for above questions

  2. how 2 find answer for above questions


  3. i need more c progam qustns(not puzzles)
    need name of pgm

  4. Wild pointer=A pointer pointing to an invalid address for exp.
    int *p=0x23ac45;
    The assigned address may be valid or invalid r/w to this address leads to segmentation fault.
    also int *p;
    p is pointing to an invalid address beware using them.

  5. generic pointer :- A pointer to void is said to be generic pointer.The most important feature of generic pointer is that it can store the address of any kind of variable may be int,char,float double etc. But int *p can store only the address of integer variable.like char *p can store only the address of char variable etc.

  6. Far Pointer :- A pointer created in one segment allcating memory from another segment is called far pointer.
    exp :- char far *p=OxB8000000;
    They are no more used bcoz of a lot of issues associated with the turbo C compiler .There is no near,far or huge in gcc compiler.

  7. Apart from complex code there is no disadvantage in using a pointer.

  8. we have heard that pointers can hold the address of integers ,characters ,floats etc. also a pointer can hold the address of function exp (*p)();In using this prototype is compulsory.

  9. Array of intergers int a[5];
    array of characters char str[40];

    Array of addresses are called as array of pointers.
    char *names[89];
    It has a numerous advantages over 2D array if used with the strings .

  10. It is 100% true to say that "Every array name and function names are constant pointers".

    int a[5];
    int * const p=(int *)malloc(5 * sizeof(int));

    The above two statements dont have exactly a single difference.

    1. This comment has been removed by the author.

    2. Except one, which is former one is stored in temporary section of memory i.e STACK which is freed by compiler automatically after the end of program and the latter one is stored in HEAP section of memory which we have to explicitly free it by calling free function in c and delete operator in c++.