Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 02-13-2014, 11:02 PM   #1
LQ Newbie
Registered: Sep 2013
Posts: 2

Rep: Reputation: Disabled
Source code objective

I'm trying to figure out what this source code does. I keep on getting an error message.


double number_array[30];
int count = 0;

double calc_sum();
void print_list();
double get_number();

double calc_mean(double *list) {
double sum = calc_sum(list);
return sum / count;

double calc_std_dev(double *list) {
int index = 0;
double sum = 0;

double mean = calc_mean(list);

while (list[index] != 0) {
sum += (list[index] - mean) * (list[index] - mean);

return sqrt(sum / (count -1));

void create_list() {
int number = 0, index = 0;

do {
number_array[index] = get_number();
number = number_array[index++];
} while (number != 0); // if user enter 0, quit

count = index - 1;

void read_from_file() {

int main() {
printf("mean = %f \n", calc_mean(number_array));
printf("std dev = %f \n", calc_std_dev(number_array));
Old 02-13-2014, 11:37 PM   #2
John VV
LQ Muse
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,239

Rep: Reputation: 2522Reputation: 2522Reputation: 2522Reputation: 2522Reputation: 2522Reputation: 2522Reputation: 2522Reputation: 2522Reputation: 2522Reputation: 2522Reputation: 2522
please use code tags!!!!
PHP Code:
 [codethe code that NEEDS TO BE IN BETWEEN THE TAGS [/code
this is what it is supposed to do it you were to post all of it
printf("mean = %f \n", calc_mean(number_array));
printf("std dev = %f \n", calc_std_dev(number_array));
and without knowing what that unknown error is
there is no way to help

PLEASE READ the guide on posting
and included the NEEDED information

the operating system you are using ?
the version of said OS ?
the FULL build line you are using
and the MOST important part

Last edited by John VV; 02-13-2014 at 11:40 PM.
1 members found this post helpful.


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
GPL code vs my private source code???? DennisC31 Linux - General 7 03-08-2011 11:24 AM
Where in the source code do I find the source for the Cisco FCoE HBA Drvr? madcowtricks Slackware 6 01-27-2011 04:00 PM
LXer: Source code released for Diaspora, an open source, distributed alternative to Facebook LXer Syndicated Linux News 1 09-17-2010 05:53 AM
[SOLVED] why I couldn't find the source code of printf function in glibc source? famsinyi Programming 5 09-21-2009 10:06 AM
starting to code.. with an objective viniosity Programming 10 02-09-2005 12:05 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:45 PM.

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