actually the code is correct
line no 5 has been repeated again with type casting.thats it...
both the code gives the same answer 2 5
On Fri, Sep 16, 2011 at 11:58 PM, wellwisher p9047551...@gmail.com wrote:
but your programming is giving compilation error
http://ideone.com/sqsNn
the
#includestdio.h
int main()
{
int a[5]={1,2,3,4,5};
int *ptr=(a + 1);
printf(%d %d\n,*(a+1),*(ptr-1));
return 0;
}
Find the output!
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
a[]= {1, 2, 3, 4,5}
a
a
a+1
a+1
a is address of whole array...so a+1 means next element after array
completion.
so ptr-1 will point to 5
...
On Fri, Sep 16, 2011 at 1:25 PM, Anup
On Friday, 16 September 2011 13:25:38 UTC+5:30, Anup wrote:
#includestdio.h
int main()
{
int a[5]={1,2,3,4,5};
int *ptr=(a + 1);
int *ptr=(int *)(a + 1);
printf(%d %d\n,*(a+1),*(ptr-1));
return 0;
}
Find the output!
Now it will print 2 5
--
You received this message
it will print 2,5
On Fri, Sep 16, 2011 at 2:35 AM, Brijesh brijeshupadhyay...@gmail.comwrote:
On Friday, 16 September 2011 13:25:38 UTC+5:30, Anup wrote:
#includestdio.h
int main()
{
int a[5]={1,2,3,4,5};
int *ptr=(a + 1);
int *ptr=(int *)(a + 1);
printf(%d
Brijesh is right.until u do the type casting it will show an error
On Fri, Sep 16, 2011 at 5:57 AM, Pradip Singh qnit...@gmail.com wrote:
it will print 2,5
On Fri, Sep 16, 2011 at 2:35 AM, Brijesh brijeshupadhyay...@gmail.comwrote:
On Friday, 16 September 2011 13:25:38 UTC+5:30,
thank to explain to this problem...
On Fri, Sep 16, 2011 at 1:40 PM, Yogesh Yadav medu...@gmail.com wrote:
a[]= {1, 2, 3, 4,5}
a
a
a+1
a+1
a is address of whole array...so a+1
What does one mean by 'address of the whole array' ?
On Fri, Sep 16, 2011 at 8:11 PM, mohan kumar mohankumar...@gmail.comwrote:
thank to explain to this problem...
On Fri, Sep 16, 2011 at 1:40 PM, Yogesh Yadav medu...@gmail.com wrote:
a[]= {1, 2, 3, 4,5}
but your programming is giving compilation error
http://ideone.com/sqsNn
the first one is giving output 2 and 5
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe
Plz indicate the output of the following code and explain why is it so..
*char *modify (char *s)
{
#define MAX 15
char buffer[MAX];
strcpy (buffer, s);
buffer[0] = 'H';
return buffer;
}
int
main ()
{
printf (hello!!!);
printf (%s , modify (hello!!!));
}*
10 matches
Mail list logo