C Programming - Pointers

1.
Are the expression *ptr++ and ++*ptr are same?
True
False
Answer: Option
Explanation:
*ptr++ increments the pointer and not the value, whereas the ++*ptr increments the value being pointed by ptr

2.
Will the program compile?
#include<stdio.h>
int main()
{
    char str[5] = "IndiaBIX";
    return 0;
}
True
False
Answer: Option
Explanation:

C doesn't do array bounds checking at compile time, hence this compiles.

But, the modern compilers like Turbo C++ detects this as 'Error: Too many initializers'.

GCC would give you a warning.


3.
The following program reports an error on compilation.
#include<stdio.h>
int main()
{
    float i=10, *j;
    void *k;
    k=&i;
    j=k;
    printf("%f\n", *j);
    return 0;
}
True
False
Answer: Option
Explanation:
This program will NOT report any error. (Tested in Turbo C under DOS and GCC under Linux)

The output: 10.000000

4.
Are the three declarations char **apple, char *apple[], and char apple[][] same?
True
False
Answer: Option
Explanation:
No answer description is available. Let's discuss.