C return statement 🔙

preview_player
Показать описание
C return statement tutorial example explained

#C #return #statement

double square(double x)
{
double result = x * x;
return result;
}

int main()
{
double x = square(3.14);
printf("%lf", x);

return 0;
}
Рекомендации по теме
Комментарии
Автор

#include <stdio.h>

double square(double x)
{
double result = x * x;
return result;
}

int main()
{
double x = square(3.14);
printf("%lf", x);

return 0;
}

BroCodez
Автор

really helpful, thanks a lot for explaining this

kjnhuis
Автор

super faster guide, takes 1 minute and you understand what is going on, i love you)))

ccgnhyd
Автор

Thank you so much sir for clearing my concept ❤🔥❤🚩

divyrajverma
Автор

The sets of parenthesis is like a pair of telephone. Love it

retrofel
Автор

I thought😪 you only use %lf when its scanf and %f for printf

saintpierre
Автор

I really didn't understand it at first, that return 0; at the end really confused me but i replayed it a couple times and it becomes clear and simple

Dr.andonuts
Автор

Great video! Buy why is a return statement necessary? What does it do or how does it help?

kwadwoomariboateng
Автор

But if we not write return 0; the compiler will not gives error, so why we should write it every time and make the program slower?

mohdhammad
Автор

If I want to return a string, How would I do it?

prumchhangsreng
Автор

Is it possible to return more than one variable?

victoriamoro
Автор

radom comment for more recomendation lol yt algoritam hacked

tanjakilibarda
Автор

Here's some code I made using the return statement:

#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include <math.h>
#include <ctype.h>

double half(double number){
return number / 2;
}

int main(){
double userInput = 0;
printf("What number would you like to cut in half?\n");
scanf("%lf", &userInput);
printf("\nYour result is %.3lf", half(userInput));
return 0;
}

PSIwolf