Question 32
#includevoid main() { int k=5; int *p=&k; int **m=&p; printf("%d %d %d",k,*p,**m); }
Question 33
int a, *b=&a, **c=&b;The following program fragment
a=4; **c=5;
Question 36
main() { char g[] = "geeksforgeeks"; printf("%s", g + g[6] - g[8]); }
Question 37
# include <stdio.h>
# define swapl (a, b) tmp = a; a = b; b = tmp
void swap2 ( int a, int b)
{
int tmp;
tmp = a; a = b; b = tmp;
}
void swap3 (int*a, int*b)
{
int tmp;
tmp = *a; *a = *b; *b = tmp;
}
int main ()
{
int num1 = 5, num2 = 4, tmp;
if (num1 < num2) {swap1 (num1, num2);}
if (num1 < num2) {swap2 (num1 + 1, num2);}
if (num1 >= num2) {swap3 (&num1, &num2);}
printf (\"%d, %d\", num1, num2);
}
/* Add code here. Remove these lines if not writing code */
Question 38
The value printed by the following program is
void f(int* p, int m)
{
m = m + 5;
*p = *p + m;
return;
}
void main()
{
int i=5, j=10;
f(&i, j);
printf(\"%d\", i+j);
}
Question 39
Pick the best statement for the following program snippet:
#include <stdio.h>
int main()
{
int var; /*Suppose address of var is 2000 */
void *ptr = &var;
*ptr = 5;
printf(\"var=%d and *ptr=%d\",var,*ptr);
return 0;
}
Question 40
What does the following program print?
#include
void f(int *p, int *q)
{
p = q;
*p = 2;
}
int i = 0, j = 1;
int main()
{
f(&i, &j);
printf(\"%d %d \\n\", i, j);
getchar();
return 0;
}
There are 43 questions to complete.