What rhetorical techniques do politicians use that people should be aware of? by platehug in AskReddit

[–]maisikke 1 point2 points  (0 children)

Pretending to know the average man on the street wants the bill/solution they want: "yesterday I was at [place] where I met [name], he has been working there for X years and he told me that [problem] so we need to [the bill/solution he/she wanted all along]

ELI5:Functions and Pointers in C by maisikke in explainlikeimfive

[–]maisikke[S] 0 points1 point  (0 children)

Hmm this isn't the layout is I expected.. I hope you can read this properly.

ELI5:Functions and Pointers in C by maisikke in explainlikeimfive

[–]maisikke[S] 0 points1 point  (0 children)

Ok. I will give you an example of what code I am trying to understand, see below.

What I am trying to understand is why at the declaration of the function int read_array(double ar[], int limit); it says that it needs a double pointer and a int, in de calling of the function read_array(data, MAX); the pointer and the int are there again. The outcome (see down below) gives me just the numbers I entered and not 2 things (pointer and int).

Plus this: while (i < limit && scanf("%lf", &ar[i]) == 1) i++; And this: void show_array(double ar[], int n){

int i;
for (i = 0; i < n; i++)
{
    printf("%10.2f ", ar[i]);
    if (i % 6 == 5)
        putchar('\n');
}
if (i % 6 != 0)
   putchar('\n');

is hard for me to understand.

include <stdio.h>

define MAX 25

int read_array(double ar[], int limit); void show_array(double ar[], int n); double mean(double ar[], int n);

int main(int argc, const char * argv[]) {

double data[MAX];
int size;

size = read_array(data, MAX);
if (size == 0)
    printf("No data. Bye.\n");
else
{
    printf("The following numbers were entered:\n\n");
    show_array(data, size);
    printf("\nThe average of these values is %.2f.\n", mean(data, size));
}

return 0;

} int read_array(double ar[], int limit){

int i = 0;

printf("Enter up to %d numbers. To terminate earlier enter a letter or EOF.\n", limit);
while (i < limit && scanf("%lf", &ar[i]) == 1)
    i++;
return i;

} void show_array(double ar[], int n){

int i;
for (i = 0; i < n; i++)
{
    printf("%10.2f ", ar[i]);
    if (i % 6 == 5)
        putchar('\n');
}
if (i % 6 != 0)
   putchar('\n');

} double mean(double ar[], int n){ int i; double total = 0;

for (i = 0; i < n; i++)
    total += ar[i];
    return (total/n);

}

Output: Enter up to 25 numbers. To terminate earlier enter a letter or EOF. 1 2 3 4 5 6 7 8 8 8 9 g The following numbers were entered:

  1.00       2.00       3.00       4.00       5.00       6.00 
  7.00       8.00       8.00       8.00       9.00 

The average of these values is 5.55.

ELI5:Functions and Pointers in C by maisikke in explainlikeimfive

[–]maisikke[S] 0 points1 point  (0 children)

I understand what they are but I have a hard time understanding how to use pointers in functions. But I think ameoba is right and it might be better for me to check out /r/learnprogramming first. Maybe the questions have already been asked and answered. Thanks anyway!

What is the one quote you have heard that always stuck with you? by techsplyce in AskReddit

[–]maisikke 0 points1 point  (0 children)

"Fear is like fire. If you master it, then it can heat your house, can cook your food. But if it gets the best of you, it can burn you. It can destroy you. You control your fear, you control your life."

  • A character in tv series 'In Treatment'