Pointers
- 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 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 main()
{
char *ptr1 = "Interview Mania";
char *ptr2 = ptr1;
printf("%p %p", ptr2, ptr1);
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: B
Same memory address is printed
- What will be the output of the following C code?
#include <stdio.h>
void main()
{
char *str= "WATCH";
char *ptr = str;
printf("%c %c", 1[ptr], str[1]);
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
A A
- What will be the output of the following C code?
#include <stdio.h>
int main()
{
int array[5] = {11, 12, 13, 14, 15};
int *ptr = array + 7;
printf("%d\n", ptr[-3]);
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: E
15