Pointers
- What will be the output of the following C code?
#include <stdio.h>
void main()
{
int arr[4] = {11, 12, 13, 14};
int *ptr = arr;
printf("%p\t%p", ptr, arr);
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
Same memory address is printed
- What will be the output of the following C code?
#include <stdio.h>
void count(int m, int n)
{
printf("%d\n", m);
}
void main()
{
int i = 12, j = 11;
count(i, j);
printf("%d %d\n", i, j);
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
12
12 11
- What will be the output of the following C code?
#include <stdio.h>
void function(int m, int n)
{
printf("%d %d\n", m, n);
}
void main()
{
int s = 16, t = 15;
function(s);
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: E
Compilation Error
main.c: In function ‘main’:
main.c:9:9: error: too few arguments to function ‘function’
function(s);
^~~~~~~~
main.c:2:10: note: declared here
void function(int m, int n)
- 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 can never be sent by call-by-value?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
Array