LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-13-2014, 10:04 PM   #1
1969JCW
LQ Newbie
 
Registered: Sep 2013
Posts: 2

Rep: Reputation: Disabled
Trying to find what the error is and how to correct


#include<stdio.h>

void print_list(double *num_arr_ptr) {
int index = 0;

printf("\nYour numbers are...\n");
while (num_arr_ptr[index] != 0) {
printf("%5.2f\t",num_arr_ptr[index]);
index++;
if (index % 8 == 0)
printf("\n");
}
printf("\nlist size = %d \n", index);
}

double calc_sum(double *num_arr_ptr) {
int index = 0;
double sum = 0;

while (num_arr_ptr[index] != 0) {
sum += num_arr_ptr[index];
//printf("sum = %f\n", sum);
index++;
}
return sum;
}

double get_number() {
float value;

printf("Enter a number (zero to end) >>> ");
scanf("%f",&value);
return (double) value;
}
 
Old 02-13-2014, 10:44 PM   #2
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 3,333

Rep: Reputation: Disabled
It would have been nice if you had put that code inside [code] tags, as that would have made it a lot easier to read and would also preserved any formatting, like the indentation I sincerely hope is present in the original source code.

It would have been even better it you had explained or indeed said anything about the nature of the problem.

It would have been just splendid if you had said something along the lines of "I'm trying to create a program that does A, B and C, but I keep getting the error message XYZ", instead of expecting other to copy, paste and compile your code, run it, check the results, analyze the source code, and try to figure out what the problem might be.
 
Old 02-13-2014, 10:45 PM   #3
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,622

Rep: Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651
see the other post !!!
there is no way anyone can help without any of the needed information
http://www.linuxquestions.org/questi...4/#post5117322

and answer
1) what are you doing ?
2) what is it you NEED to do ?
3) where did you get the code ?
4) what does the textbook say about it ?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Fix input/output error or find correct webcam driver for icecam2? agingcomputer Linux - Hardware 0 03-25-2010 08:06 AM
Cannot find correct Qt headers! drussell6 Linux - Software 2 07-03-2008 07:38 AM
Cant find correct kernel source. e-buzz SUSE / openSUSE 2 07-03-2005 07:45 AM
how to find correct tty number? SeanatIL Linux - Hardware 1 07-07-2004 07:03 PM
How to find the correct /dev/ttyS*? SeanatIL Linux - Software 1 07-07-2004 06:33 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:16 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration