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..
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 |
write a program which counts a product of array elements lower than 10.
What are the 3 types of structures?
program to find which character is occured more times in a string and how many times it has occured? for example in the sentence "i love india" the output should be i & 3.
can anyone proide me reading material on svit00ef27@yahoo.com please thanx in advance
WHAT IS MAXIMUM SIZE OF AN ARRAY IN C LANGUAGE?
8 Answers Carphone Warehouse, IBM, SAS,
What does d mean?
who did come first hen or agg
write a program to print calender using for loop.
array contains zeros and ones as elements.we need to bring zeros one side and one other side in single parse. ex:a[]={0,0,1,0,1,1,0,0} o/p={0,0,0,0,0,1,1,1}
Is it possible to pass an entire structure to functions?
Is there something we can do in C but not in C++? Declare variable names that are keywords in C++ but not C.
Which is the memory area not included in C program? give the reason