Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » problem in eclipse(scanf problem)
problem in eclipse [message #1444068] Mon, 13 October 2014 15:38 Go to next message
Manoj kumar is currently offline Manoj kumarFriend
Messages: 1
Registered: October 2014
Junior Member
i frequently use eclipse to do c programs . but when we use a scanf statement in the program the program wont get terminate,and if we give values before the program get terminate,it is showing the correct output. if we manually terminate the program it is showing garbage values.
example program which wrote using eclipse indigo:
#include <stdio.h>
#include <stdlib.h>

int main(void) {
int a,b,addition;
printf("enter a,b no.s");
scanf("%d%d",&a,&b);
addition=a+b;
printf("add of a,b is %d",addition);
}
output ,giving values before termination:
1 2
enter a,b no.sadd of a,b is 3

output,manually termination:
enter a,b no.sadd of a,b is 2147344440
Re: problem in eclipse [message #1444151 is a reply to message #1444068] Mon, 13 October 2014 18:11 Go to previous messageGo to next message
Tauno Voipio is currently offline Tauno VoipioFriend
Messages: 742
Registered: August 2014
Senior Member
Please check the return value of scanf(), see scanf manual page.


--

Tauno Voipio
Re: problem in eclipse [message #1454591 is a reply to message #1444151] Tue, 28 October 2014 15:05 Go to previous messageGo to next message
Lazy Shetty is currently offline Lazy ShettyFriend
Messages: 3
Registered: October 2014
Junior Member
@ Tauno Voipio

Hi,

can you help me find the scanf manual page, is it over the web or it is in the eclipse,..??
Re: problem in eclipse [message #1454800 is a reply to message #1454591] Tue, 28 October 2014 19:43 Go to previous message
Tauno Voipio is currently offline Tauno VoipioFriend
Messages: 742
Registered: August 2014
Senior Member
The man pages should be installed along with your C translator and library toolkit.

They are usually accessed from the terminal with
man scanf

Google seems to find pretty well the man pages.

Have you tried to leave the mouse cursor resting on the scanf symbol in your CDT source code editor?


--

Tauno Voipio
Previous Topic:ARM project - adding include paths
Next Topic:Build CDT project without blocking other workspace jobs
Goto Forum:
  


Current Time: Thu Oct 03 20:20:23 GMT 2024

Powered by FUDForum. Page generated in 0.03493 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top