C++ Tutorial for Beginners 14 - Return Values in Functions

preview_player
Показать описание

Searches related to c++ function return value
what is a function c++
c++ main function return value
function must return a value c++
c++ macro function return value
c++ function overloading return value
c++ const function return value
c++ function return value reference
c++ function return multiple values
Комментарии
Автор

2:35 actually there is no need to declare result is equal to 0

sharonjoe
Автор

Your videos help me so much thank you! 
I hope you make more!

lelegricc
Автор

i have a question sir, does the multiply* (253, 456) which equals 1418 are stored in the mainResult and also store from the other variable named "result" from the sum function?

micograal
Автор

your vedio is more relibel to understand

viveksahu
Автор

[Error] return-statement with a value, in function returning 'void' [-fpermissive]




#include <conio.h>
#include <stdio.h>
#include <math.h>
void fill_array(int x[], int SIZE);
void display_array(int x[], int SIZE);
void sum_count(int x[], int SIZE, float *sum, int *k);
int main()
{
    int C[40], D[30], SIZE;
fill_array(C, SIZE);
fill_array(D, SIZE);
display_array(C, SIZE);
display_array(D, SIZE);
printf("SIZE=%.2f SIZE=%.2f\n", SIZE, SIZE);
getch();
}
void display_array(int x[], int SIZE)
{
int i;
printf("input array x %d\n", SIZE);
for(i=0;i<SIZE;i++)
{
scanf("%f", &x[i]);
}
}
void sum_count(int x[], int SIZE, float *sum, int *k)
{
  int i;
  *sum=x[0];
for(i=0;i<SIZE;i++)
if(x[i]=5 && x[i]<=25)
    *sum=x[i];
     *k++;
return *sum;
}


please i have problem at my return *sum; help please

clementefioase
Автор

I was expecting a way to return multiple values

cyrus
Автор

You totally went off topic when got to main.

kv
Автор

This video is a little bit too harsh for beginners, should've taken a more relaxed approach that shows returning a value instead of returning and making a variable to store a logic sum of another variable and the functions return variable.

jesuschrist