25. | What will be the output of the program ? #include
void fun(int **p);
int main()
{
int a[3][4] = {1, 2, 3, 4, 4, 3, 2, 8, 7, 8, 9, 0};
int *ptr;
ptr = &a[0][0];
fun(&ptr);
return 0;
}
void fun(int **p)
{
printf("%d\n", **p);
}
|
|||||||
|
26. | What will be the output of the program ? #include
int main()
{
static int arr[] = {0, 1, 2, 3, 4};
int *p[] = {arr, arr+1, arr+2, arr+3, arr+4};
int **ptr=p;
ptr++; printf("%d, %d, %d\n", ptr-p, *ptr-arr, **ptr);
*ptr++; printf("%d, %d, %d\n", ptr-p, *ptr-arr, **ptr);
*++ptr; printf("%d, %d, %d\n", ptr-p, *ptr-arr, **ptr);
++*ptr; printf("%d, %d, %d\n", ptr-p, *ptr-arr, **ptr);
return 0;
}
|
|||||||
|
27. | Which of the following is correct way to define the function fun() in the below program? #include
int main()
{
int a[3][4];
fun(a);
return 0;
}
|
|||||||
|
28. | What will be the output?? #include< stdio.h>
#include< conio.h>
void main()
{
int arr[] = { 51,32,43,24,5,26};
int i;
for(i=0;i<=5;i++)
printf("\n%d %d %d %d",arr[i],*(i+arr),*(arr+i),i[arr]);
getch();
}
|
|||||||
|
29. | What will be the output of this program? #include
using namespace std;
int array1[] = {1200, 200, 2300, 1230, 1543};
int array2[] = {12, 14, 16, 18, 20};
int temp, result = 0;
int main()
{
for (temp = 0; temp < 5; temp++) {
result += array1[temp];
}
for (temp = 0; temp < 4; temp++) {
result += array2[temp];
}
cout << result;
return 0;
}
|
|||||||
|
30. | What will be the output of the this program? #include
using namespace std;
int main ()
{
int array[] = {0, 2, 4, 6, 7, 5, 3};
int n, result = 0;
for (n = 0 ;n < 5 ;n++) {
result += billy[n];
}
cout << result;
return 0;
}
|
|||||||
|
« previous
1
2
3
4
5
6
7
8
9
...next »