943,708 Members | Top Members by Rank

View Poll Results: do u have any query?
y:yes 5 100.00%
n:no 0 0%
Multiple Choice Poll. Voters: 5. You may not vote on this poll

Ad:
  • C Discussion Thread
  • Unsolved
  • Views: 804
  • C RSS
Oct 14th, 2008
-1

program in c

Expand Post »
U can find all the program in c.If du u have any query about c plz ask me and also program
Similar Threads
Reputation Points: 3
Solved Threads: 0
Newbie Poster
gunjanagrawal is offline Offline
1 posts
since Oct 2008
Oct 14th, 2008
0

Re: program in c

Hi gunjan,

Can you please tell me what is the difference between
void function(int*d);
and
void function(int &d);
both above are function declarations and both we do the changes to the original variable passed to the function. Then what is the exact difference.

Thanks in advance
Reputation Points: 45
Solved Threads: 1
Junior Poster in Training
rati is offline Offline
78 posts
since Aug 2006
Oct 14th, 2008
0

Re: program in c

H...!

Can you please tell me out of fgets() and gets() which function is safe to use and why? If possible give an example program for explanation.
Reputation Points: 10
Solved Threads: 0
Light Poster
cutedipti is offline Offline
45 posts
since Sep 2008
Oct 14th, 2008
0

Re: program in c

fgets is always safe... cause in fgets we can specify the size of the string that should be read... in such a case we can be sure only the specified no of bytes will be read...

gets is not like that... it will read whatever we give and may overwrite the memory locations not allocated for that particular string variable...


eg:
  1. char acName[20];
  2.  
  3. /* Using fgets */
  4. fgets(acName, 20, stdin);
  5.  
  6. /* Using gets */
  7. gets(acName);

For the first one using fgets, even if we give any string greater than 20 in length, it will accept only 20.... but in gets if we give string of length 30, it will accept all the 30 and over write the memory locations not allocated for acName...


Hope it clears your doubt...
Reputation Points: 51
Solved Threads: 14
Junior Poster
ahamed101 is offline Offline
114 posts
since Jul 2008
Oct 14th, 2008
1

Re: program in c

Click to Expand / Collapse  Quote originally posted by rati ...
Hi gunjan,

Can you please tell me what is the difference between
void function(int*d);
and
void function(int &d);
both above are function declarations and both we do the changes to the original variable passed to the function. Then what is the exact difference.

Thanks in advance
The first one is "passing arguments to pointers". In that way, you can change original variable!
Second one is "passing arguments as references".
You cannot do that in C, C always passes arguments by value (yes, even if you use pointers, but then it passes pointer as value, not original value pointed by pointer )

So, the first one is ok in C and C++
Second one is only C++
Reputation Points: 110
Solved Threads: 43
Posting Whiz in Training
Sci@phy is offline Offline
279 posts
since Sep 2008
Nov 2nd, 2008
0

Re: program in c

im having lot of problems in c and c++ programs...can u please tell me the sites where i ciuld find the solutions of almost all c/c++ programs..
Reputation Points: 10
Solved Threads: 0
Newbie Poster
rohanvijay is offline Offline
4 posts
since Oct 2008
Nov 2nd, 2008
0

Re: program in c

Click to Expand / Collapse  Quote originally posted by rohanvijay ...
im having lot of problems in c and c++ programs...can u please tell me the sites where i ciuld find the solutions of almost all c/c++ programs..
Solutions to ALMOST ALL C/C++ programs? That's asking for quite a lot, dontcha think? We don't even have ALMOST ALL C/C++ problems yet.
Reputation Points: 124
Solved Threads: 18
Junior Poster
devnar is offline Offline
148 posts
since Sep 2008
Nov 2nd, 2008
0

Re: program in c

The OP was clearly trolling.
Reputation Points: 163
Solved Threads: 91
Posting Pro in Training
nucleon is offline Offline
476 posts
since Oct 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C Forum Timeline: Game Of Life 3D
Next Thread in C Forum Timeline: Help Me Please





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC