Pointers
- 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};
- 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.
- 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 will be the output of the following C code?
#include <stdio.h>
int main()
{
int num[6] = {6, 7, 8, 9, 10};
printf("%d\n", *num);
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: E
6