Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


void main()
{
int s[4][2]={ {1234,56},{1212,33},{1434,80},{1312,78} };
int (*p)[2];
int i,j,*pint;
for(i=0;i<=3;i++)
{
p=&s[i];
pint=p;
printf("\n");
for(j=0;j<=1;j++)
printf("%d",*(pint+j));
}
} while running this program it shows a warning-suspicious
pointer conversion ie pint=p; my que is why should we assign
the value of p to pint again.why cant we use it directly as
*(p+j)..but if i use like tat the o/p is garbage value..



void main() { int s[4][2]={ {1234,56},{1212,33},{1434,80},{1312,78} }; int (*p)[2]; int i,j,*pin..

Answer / test

p ia pointer to an array when p is incremented it will increment by the number of elements in the array...
for example
int (*p)[2]; //it is aponiter to an arry of 2 elements so when we do p+1 then it will be incremented by two*(sizeof(int))
so leading to the garbage value at the last loop..

can be properly analyzed by the below program

#include<stdio.h>


main()
{
int s[4][2]={ {1234,56},{1212,33},{1434,80},{1312,78} };
int (*p)[2];
int i,j,*pint;
for(i=0;i<=3;i++)
{
p=&s[i];
//pint=p;
printf("\n");
for(j=0;j<=1;j++)
printf("%p.....%d\n",*(p+j),**(p+j));
}
}

Is This Answer Correct ?    23 Yes 2 No

Post New Answer

More C Interview Questions

Here is a good puzzle: how do you write a program which produces its own source code as output?

0 Answers  


What is the difference between null pointer and the void pointer?

3 Answers  


What are data types in c language?

0 Answers  


ATM machine and railway reservation class/object diagram

0 Answers   Zycus Infotech,


What does do in c?

0 Answers  


Explain the difference between null pointer and void pointer.

0 Answers   TCS,


How can I rethow can I return a sequence of random numbers which dont repeat at all?

0 Answers  


What is pointer to pointer in c?

0 Answers  


What does the c preprocessor do?

0 Answers  


Hi can anyone tell what is a start up code?

0 Answers   CTS,


What is floating point constants?

0 Answers  


Write a program to accept a character & display its corrosponding ASCII value & vice versa?

9 Answers  


Categories