Forums.Sureshkumar.net : A Perfect Place to Share Knowledge         Blogs     Games    Magazines    

"Sharing knowledge does not lessen your store, often it gets you more. Sharing plays a key role in relationships and bonding, happens in small steps and is assisted through community membership."

Go Back   SURESHKUMAR.NET FORUMS > TECHNICAL DISCUSSIONS > DATA STRUCTURES, C, C++, VC ++ > ds. c , c++ Interview / Technical Questions
Register FAQ Members List Calendar Games Blogs Search Today's Posts Mark Forums Read

ds. c , c++ Interview / Technical Questions Kindly solve an many as questions you can. It will sharpen your skills and those solutions will help others too.

   

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
Old 27-11-07, 03:16 PM   #1 (permalink)
Junior Member
 
Join Date: Sep 2007
Age: 25
Posts: 16
Thanks: 1
Thanked 0 Times in 0 Posts
Thanks: 1
Thanked 0 Times in 0 Posts
Rep Power: 2 gouriproutray is on a distinguished road
Smile urgent help...required please..PLEASE SEND ME THE REASON

/*PLEASE SEND ME THE REASON*/
#include<stdio.h>
#include<conio.h>
void main()
{
int aa[]={1,2,3};
printf("\n%d %d",aa,aa+1);
/* for this the out put something like: 8874 9239*/

printf("\n%d..........",aa);
printf("\n%d..........",aa+1);
/*and for this output is 8874 and 8876*/
}
/* the same thing is present in three printf ()
one single printf and other twos are in separate printf()...then why the outputs are different */
gouriproutray is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 27-11-07, 08:32 PM   #2 (permalink)
Super Moderator
 
sk_kireeti's Avatar
 
Join Date: Feb 2006
Location: Hyderabad
Posts: 2,355
Thanks: 117
Thanked 241 Times in 198 Posts
Thanks: 117
Thanked 241 Times in 198 Posts
Blog Entries: 4
Rep Power: 51 sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute
Re: urgent help...required please..PLEASE SEND ME THE REASON

gouriproutray,

I don't have C compiler installed in my system. If you can send that to me, it will be nice help for me to do some R&D around this.

My initial observation says, the issue could be because of the declaration. C can't accommodate dynamic arrays and in this case you didn't specify the size of the array. Thats why I guess compiler is behaving peculiarly.

Thanks,
Krishna
__________________
Give 1 cup rice to a hungry Indian just by a mouse click. No money, no form filling, no hassle... Click here for the donation.
sk_kireeti is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 28-11-07, 12:02 PM   #3 (permalink)
Junior Member
 
Join Date: Aug 2007
Age: 25
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 2 sajishk@gmail.com is on a distinguished road
Re: urgent help...required please..PLEASE SEND ME THE REASON

I dont think it is a case of not specifying the size of array because if we dont provide the size but if we mention the members of array then also it will accept without any error.......
ie
int arr[2]={1,2,3};
int arr[]={1,2,3};
//Both the above statement are same and valid...
Gouriproutray try to execute the the abv prog using Turbo C compiler, you will find that all the time you will get the same output......
sajishk@gmail.com is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 29-11-07, 11:28 AM   #4 (permalink)
Junior Member
 
Join Date: Sep 2007
Age: 25
Posts: 16
Thanks: 1
Thanked 0 Times in 0 Posts
Thanks: 1
Thanked 0 Times in 0 Posts
Rep Power: 2 gouriproutray is on a distinguished road
Re: urgent help...required please..PLEASE SEND ME THE REASON

In that question science aa is a array name, so only specifying the array name(like aa what i mentioned in the question) gives the address of the 1st element if it is a 1-d array. And simply specifying aa+1 gives the address of the 2nd element (if 1st one is 100,then 2nd one is 102).but what my compiler shows i mentioned in the question..now i am asking that is my compiler is a wrong one anything theory behind this.that shows the different out put



Actually i have a c++ compiler.but that's not a turbo compiler..
gouriproutray is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 29-11-07, 12:10 PM   #5 (permalink)
Super Moderator
 
sk_kireeti's Avatar
 
Join Date: Feb 2006
Location: Hyderabad
Posts: 2,355
Thanks: 117
Thanked 241 Times in 198 Posts
Thanks: 117
Thanked 241 Times in 198 Posts
Blog Entries: 4
Rep Power: 51 sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute
Re: urgent help...required please..PLEASE SEND ME THE REASON

Every compiler has its own implementation and each react differently for different situations/statements.
__________________
Give 1 cup rice to a hungry Indian just by a mouse click. No money, no form filling, no hassle... Click here for the donation.
sk_kireeti is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 29-11-07, 01:16 PM   #6 (permalink)
Junior Member
 
Join Date: Aug 2007
Age: 25
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 2 sajishk@gmail.com is on a distinguished road
Re: urgent help...required please..PLEASE SEND ME THE REASON

There is nothing like ur "Compiler is wrong"....I do agree with Keerthi that different Compiler n Interpreter react according to the resources available n the statements executed .....thats why when u want to execute n get the desirable results u must make sure that ur compiler is the one which gives u the best resuls....Hence I suggested u to use Turbo C.

Hope now ur query has got the desirable answer..
sajishk@gmail.com is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
GOOD OPPURTUNITY.GRAB IT Rena HOT JOBS 13 03-10-08 08:37 PM
IT company address abeetha.m Companies Info & Recruitment Process 7 11-02-08 06:13 PM
Walkin for J2EE Professionals on 3rd / 4th February 2007 sridhar Walk-ins 0 03-02-07 01:18 PM
urgent C#, .Net Professionals Required sridhar FRESHER JOBS 0 12-01-07 08:48 PM
urgent C#, .Net Professionals Required sridhar EXPERIENCED JOBS 0 11-01-07 06:30 PM


All times are GMT +6.5. The time now is 05:02 AM.





Search Engine Optimization by vBSEO 3.1.0