Documente Academic
Documente Profesional
Documente Cultură
3. What would be the output of the following program assuming that the array begins at location
1002?
#include <stdio.h>
main()
{
int a[3][4] = { 1,2,3,4,
5,6,7,8,
9,10,11,12
};
printf("\n %u \t %u \t %u", a[0]+1, *(a[0]+1), *(*(a+0)+1));
}
4. What would be the output of the following program assuming that the array begins at location
1002?
#include <stdio.h>
main()
{
int a[2][3][4] = {
{
1,2,3,4,
5,6,7,8,
9,1,1,2
},
{
2,1,4,7,
6,7,8,9,
0,0,0,0
}
};
5. In the following program add a statement in the function fun() such that address of a gets stored in
j.
#include <stdio.h>
main()
{
int *j; void fun(int **); fun(&j);
}
void fun(int ** k)
{
int a = 10;
/* add statement here */
}
8. What would be the output of the following program, if the array begins at address 1200?
#include <stdio.h>
main()
{
int arr[] = {2, 3, 4, 1, 6};
printf("%d\t%d", arr, sizeof(arr));
}
13. What would be the output of the following program, if the array begins at 65486?
#include <stdio.h>
main()
{
int arr[] = {12, 14, 15, 23, 45};
printf("%u\t%u\t%u", arr, arr+1, &arr+1);
}
16. What would be the output of the following program if the array begins at 65472?
#include <stdio.h>
main()
{
int a[3][4] = { 1,2,3,4,
4,3,2,1,
7,8,9,0 };
printf("\n%u\t%u", a+1, &a+1);
}
18. For the following statements would arr[3] and ptr[3] fetch the same character? <Yes/No>
char arr[] = "Surprised";
char *ptr = "Surprised";
19. What would be the output of the following program, if the array begins at address 65486?
#include <stdio.h>
main()
{
int arr[] = {12, 14, 15, 23, 45};
printf("%u\t%u", arr, &arr);
}
20. What is the output of the following program.
#include<stdio.h>
main()
{
static int b[] = { 1 0 , 2 0 , 3 0 , 4 0 , 5 0 } ;
int i;
for (i = 0 ; i <= 4 ; i++)
printf ("%d", i[b]);
}