Q1. what will be output of..
void main()
{
int *p=0;
p++;
printf("\n %d",p);
}
-----------------------------------
Q2. what will be out put of
main()
{
f();
printf("\n heelo world \n");
}
f()
{
int i=0;
int a[10];
for (i=0;i<=10;++i)
a[i] = 0;
}
answer : infinte loop as it will overwrite value of I.
if we compile it with -O2 then it will store i in register so it will work
-----------------------------------
Q3
passing a double dimension arry to function with double pointer...
ans : It won;t work, in function we need to define array of pointer to int
---------------------------------
Q4.
array 1 (ex data[10] = { 66 77 34 2 3 25 36 56 57 89 }
array 2 (ex index[10] = { 8 5 4 3 7 6 1 9 0 2 }
arr2 shows the correct index position on data in array 1. we need to put all elements in array1 in according to position defined in array2 (index)
ans :
for (i=0;i<10;i++)
{
swap according to index
No comments:
Post a Comment