Pointers
- Which type of variables can have same name in different function?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
Both static variables and Function arguments
- Which of the following can never be sent by call-by-value?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
Array
- 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);
- 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
- What will be the output of the following C code?
#include <stdio.h>
int main()
{
int num = 12;
int *ptr = #
foo(&ptr);
printf("%d ", *ptr);
printf("%d ", *ptr);
}
void foo(int **const ptr)
{
int k = 13;
*ptr = &k;
printf("%d ", **ptr);
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: B
13 13 13