Pointers
- What will be the output of the following C code?
#include <stdio.h>
int main()
{
int n = 12;
int *const ptr = &n;
function(&ptr);
printf("%d\n", *ptr);
}
void function(int **ptr)
{
int k = 15;
*ptr = &k;
printf("%d\n", **ptr);
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
15
15
- Which of the following is the correct syntax to send an array as a parameter to function?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
function(&arr);
- Which of the following can never be sent by call-by-value?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
Array
- What is the maximum number of arguments that can be passed in a single function?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
253
- What will be the output of the following C code?
#include <stdio.h>
void fun(int *ptr)
{
int k = 0;
for(k = 0; k < 4; k++)
printf("%d ", ptr[k]);
}
void main()
{
int n[5] = {16, 15, 13, 21};
fun(&n);
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: B
16 15 13 21