User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the C++ section within the Software Development category of DaniWeb, a massive community of 401,691 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,778 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Views: 1969 | Replies: 19 | Solved
Reply
Join Date: Nov 2005
Posts: 39
Reputation: johnray31 is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
johnray31 johnray31 is offline Offline
Light Poster

Solution look around this problem

  #1  
Nov 16th, 2005
when i compile this program

main()
{
  struct emp
  {
     char name[20];
    float sal;
  };
 struct emp e[10]; 
int i;
for(i=0; i<=9; i++)
  scanf("%s %f", e[i].name, &e[i].sal);
}

it gives the Floating point formats not linked

but when i run this
main()
{
  float x;
 scanf("%f" , x);
}
<< moderator edit: fixed [code][/code] tags >>


it gives no error

i got the explanation of first question as
compiler encounters a reference to the address of a float so this is error

in the second program we are also passing the address of x

thn why not error

is i missing something that is not clear to me
plz explain what is going on in both the program
Last edited by Dave Sinkula : Nov 16th, 2005 at 10:26 am.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Apr 2004
Posts: 3,471
Reputation: Dave Sinkula is a glorious beacon of light Dave Sinkula is a glorious beacon of light Dave Sinkula is a glorious beacon of light Dave Sinkula is a glorious beacon of light Dave Sinkula is a glorious beacon of light Dave Sinkula is a glorious beacon of light 
Rep Power: 16
Solved Threads: 138
Colleague
Dave Sinkula's Avatar
Dave Sinkula Dave Sinkula is offline Offline
long time no c

Re: look around this problem

  #2  
Nov 16th, 2005
The first one is because it doesn't see any floating point operations, so the library is not linked. [edit]http://cboard.cprogramming.com/showt...171#post322171

The second one is not correct.
Reply With Quote  
Join Date: Nov 2005
Posts: 39
Reputation: johnray31 is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
johnray31 johnray31 is offline Offline
Light Poster

Re: look around this problem

  #3  
Nov 16th, 2005
Originally Posted by Dave Sinkula
The first one is because it doesn't see any floating point operations, so the library is not linked. [edit]http://cboard.cprogramming.com/showt...171#post322171

The second one is not correct.

u r saying that second one is not correct what do u mean by this

second one run successfully when i run it
Reply With Quote  
Join Date: Apr 2004
Posts: 3,471
Reputation: Dave Sinkula is a glorious beacon of light Dave Sinkula is a glorious beacon of light Dave Sinkula is a glorious beacon of light Dave Sinkula is a glorious beacon of light Dave Sinkula is a glorious beacon of light Dave Sinkula is a glorious beacon of light 
Rep Power: 16
Solved Threads: 138
Colleague
Dave Sinkula's Avatar
Dave Sinkula Dave Sinkula is offline Offline
long time no c

Re: look around this problem

  #4  
Nov 16th, 2005
   scanf("%f" , x);
/*
[560 Warning] argument no. 2 should be a pointer
*/
Reply With Quote  
Join Date: May 2004
Posts: 177
Reputation: jim mcnamara is on a distinguished road 
Rep Power: 5
Solved Threads: 9
jim mcnamara jim mcnamara is offline Offline
Junior Poster

Re: look around this problem

  #5  
Nov 16th, 2005
Whenever you compile C code you should enable warnings. Some compilers will not complain unless you tell them to complain.

What compiler are you using? Is it an ancient version
of BORLAND C++ or TURBO C? You really need to use a modern compiler - there are free ones on the internet starting with gcc.

And in general, don't compile straight C with a C++ compiler even though it seems to work.
Reply With Quote  
Join Date: Nov 2005
Posts: 39
Reputation: johnray31 is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
johnray31 johnray31 is offline Offline
Light Poster

Re: look around this problem

  #6  
Nov 17th, 2005
oops
Dave Sinkula i don,t see that in hurry

that is
scanf("%f" ,&x);


and i am using dev cplusplus 4 version now

but strange there were no problem in both code when i run it on dev 4 version
Reply With Quote  
Join Date: Nov 2005
Posts: 39
Reputation: johnray31 is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
johnray31 johnray31 is offline Offline
Light Poster

Re: look around this problem

  #7  
Nov 17th, 2005
plz tell me in dev 4 version how i ll see my output window it takes input in command line console but not show the output

i am totally novice for it
Reply With Quote  
Join Date: Aug 2005
Posts: 595
Reputation: SpS is on a distinguished road 
Rep Power: 5
Solved Threads: 30
SpS's Avatar
SpS SpS is offline Offline
Posting Pro

Re: look around this problem

  #8  
Nov 17th, 2005
Reply With Quote  
Join Date: Nov 2005
Posts: 39
Reputation: johnray31 is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
johnray31 johnray31 is offline Offline
Light Poster

Help Re: look around this problem

  #9  
Nov 17th, 2005
Originally Posted by sunnypalsingh
See This
http://www.daniweb.com/techtalkforums/thread33624.html

YES I SEEN THAT THREAD
i am using devc++ 4.0
and it show that there is no
#include <limits>

c:\doublly_.cpp:5: limits: No such file or directory

and it also not working with

system("PAUSE");
i also include
#include <stdlib.h> directory

what is error
Reply With Quote  
Join Date: Aug 2005
Posts: 595
Reputation: SpS is on a distinguished road 
Rep Power: 5
Solved Threads: 30
SpS's Avatar
SpS SpS is offline Offline
Posting Pro

Re: look around this problem

  #10  
Nov 17th, 2005
Use <climits> instead of <limits>...there is typing mistake there
and plz see this
http://www.bloodshed.net/faq.html
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb C++ Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the C++ Forum

All times are GMT -4. The time now is 7:57 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC