Pointers
- Which of the following arithmetic operation can be applied to pointers p and q?
(Assuming initialization as int *p = (int *)6; int *q = (int *)7;)
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
p – q
- What will be the output of the following C code?
#include <stdio.h>
int main()
{
const int num[5] = {11, 21, 31, 41, 51};
int *ptr;
ptr = num + 3;
*ptr = 50;
printf("%d\n", num[3]);
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: E
50
- What are the elements present in the array of the following C code?
int num[4] = {10};
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
10, 0, 0, 0
- What are the different ways to initialize an array with all elements as zero?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
Option A, B and C are the different ways to initialize an array with all elements as zero.
- Which of the following declaration is illegal?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
int size = 5;
int num[size] = {11, 12, 13, 14, 15};