C Programming Tutorial – 56 – Passing Arguments to Functions

Facebook – https://www.facebook.com/TheNewBoston-464114846956315/
GitHub – https://github.com/buckyroberts
Google+ – https://plus.google.com/+BuckyRoberts
LinkedIn – https://www.linkedin.com/in/buckyroberts
reddit – https://www.reddit.com/r/thenewboston/
Support – https://www.patreon.com/thenewboston
thenewboston – https://thenewboston.com/
Twitter – https://twitter.com/bucky_roberts

Comments

SenorQuichotte says:

you should inline that function and pass by reference,

Mo Neenja31 says:

Here’s my take on the conversion to USD program

#include
#include
void convert_to_USD (float euro);

int main (void)
{
float euro_price = 0.00;

printf(“Enter euro amount: n”, euro_price);
scanf(“%f”, &euro_price);
convert_to_USD(euro_price);

return 0;
}

void convert_to_USD (float euro)
{
float usd = euro * 1.37;

printf(” %.2f Euros is equal to %.2f USD n”, euro, usd);
return;
}

Mohamed Khaled says:

thanks you are great !

sivi çako says:

how to get a whole matrix from it’s initializing function using srand and take it to another function where it addition with another matrix created with srand and gives the sum of two first matrixes? so basically i want to use the elements of a matrix in a function. how do i take these elements?
thanks

Yash Thakkar says:

can u tell me shall i use int or void in all programs!! its really confusing.

k k says:

In which video i can find storage classes?

FAKEShawn says:

dude, increase the font size

Micah Rumbaugh says:

You are my new C programming professor. Thank you for helping me figure out my homework! I am so glad that there is a resource like this that is available. You’re content is very helpful, I appreciate it.

Muhammad Salman says:

I have a variable let say int c in a given function. I want to pass it to the other class let say it is function(int a, int b, int c); I want only to pass the third argument while ignore the first two. i.e. I just want to pass int c, as function (c) and it just pass it to the third argument. I dont want to pass it like function(0,0,c); .. Is there any possibility. Please advise.

Cristopher Hiesler says:

Can’t see, to blurry why dont you zoom before talking?
.

Drath Firtha says:

can any of you peeps help me, Ive got code here

#include

using namespace std;
int start() {
cout < < "Guess the hidden number [1,500]" << endl; int const hidden_number = 50; return ( hidden_number); } int main() { start(); int guess; for (int gss = 0; gss >0; gss++)
{
cin >> guess;
if (guess < hidden_number) { cout << "guess higher" << endl; } if (guess > hidden_number) {
cout < < "guess lower" << endl; } if (guess == hidden_number) { cout << "congrats it took you " << gss << " guesses" << endl; break; } } int Itemp; cin >> Itemp;

return 0;
}

for some reason hidden number is unidentified. any help would be appreciated. New to functions. Thanks

Dennis Liu says:

what does the %.2f means?? The float with 2 decimal places??

Herotruth says:

what about other types in the parameters…like strings or char

Ömer Kenan Uçmaklıoğlu says:

Thanks for everything, I will follow that channel.

Hustle N Funk says:

The tutorial was good, I just couldn’t see those small letters.

jaihind says:

Good tutorial but you made it a bit complicated. Could have been much easier just to explain the concept

Shrunken says:

Am I able to pass more than 2 arguments into a function?

Lior bm says:

You miss Command line arguments !.

Corazon Lian says:

why the variable can store the value

TheLast Dragon says:

so I googled euros/dollar exchange rate and now they’re different, cause the market never fluctuates…….

brad long says:

I’m surprised your compiler isn’t warning you about assigning doubles into float variables. I thought the literals defaulted to double when you don’t specify “f” after them. For example: float europrice1 = 1.00f;

DivoN RaY says:

BUCKY CAN U HELP ME PLS

/* Bucky can u check into this code pls…what’s wrong with this ???????Whenever i run this . … no matter wat i give as user inputs in this piece scanf(” %.2f”, &dollar1);
eg. $2.00 or whatever after ENTER it only gives > .0.00 USD = 0.00 Rupee < */ #include
#include

void convertToRupee(float dollar);

int main()
{
float dollar1;

printf(“Converting Dollar to Rupeesn”);
printf(“Enter Dollar Amount :$”);
scanf(” %.2f”, &dollar1);

convertToRupee(dollar1);

return 0;
}

void convertToRupee(float dollar){
float rupee = dollar * 66.84;
printf(“%.2f USD = %.2f Rupeen”,dollar,rupee);

return;
}

Poor Judgement says:

how can you execute several different functions in random order?

ChapletZoe says:

What if you have two functions ?

XReaperX300 says:

hey i want to write a function that gets a string and it represents a number and it returns that number  the program signiture is int str2int(char* str) how do i do that?????please help me

nioti rahman says:

how can i find minimum and maximum value for N numbers by using parameter passing in C programming ??

alfons bara says:

A black jack game!
plz if anyone has the code. with header.h, main.c func.c?

Harsh Mehra says:

why you wrote .2f

RGM says:

Excellent tutorials, keep up the great work!

Your Beni says:

u fucking rock bucky

thanura dilan says:

Thank you very much understood to the last drop <3

PotatoTaco says:

holy crap. you are a better at explaining this than my college professor. Thank you

mas bro says:

So arguments is just only piece of information from variable

Austin Nguyen says:

how would i use scanf or fget here???

Dallas says:

hey.. i wana know something.. why do i need a new void function to do
this? i mean, i’ve tried doing this equation in just one function
without (Void) and it worked.. so what’s the point from passing it to
another function?

weriak says:

it’ s 1.07 now :______(

Write a comment

*

Human Verification: In order to verify that you are a human and not a spam bot, please enter the answer into the following box below based on the instructions contained in the graphic.


Do you like our videos?
Do you want to see more like that?

Please click below to support us on Facebook!

Send this to a friend

▷ Other ReviewsVehicles   Show Cars   Motorbikes   Scooters   Bicycles   Rims & Tires   Luxury BoatsFashion   Sunglasses   Luxury Watches   Luxury Purses   Jeans Wear   High Heels   Kinis Swimwear   Perfumes   Jewellery   Cosmetics   Shaving Helpers   Fashion Hats   Modeling TipsFooding   Chef Club   Fooding Helpers   Coktails & LiquorsSports   Sport Shoes   Fitness & Detox   Golf Gear   Racquets   Hiking & Trek Gear   Diving Equipment   Ski Gear   Snowboards   Surf Boards   Rollers & SkatesEntertainment   DIY Guides   Zik Instruments   Published Books   Music Albums   Cine Movies   Trading Helpers   Make Money   Fishing Equipment   Paintball Supplies   Trading Card Games   Telescopes   Knives   Vapes   GameplaysHigh Tech   Flat Screens   Tech Devices   Camera Lenses   Audio HiFi   Printers   USB Devices   PC Hardware   Network Gear   Cloud Servers   Software Helpers   Programmer Helpers   Mobile Apps   Hearing AidsHome   Home Furniture   Home Appliances   Tools Workshop   Beddings   Floor Layings   Barbecues   Aquarium Gear   Safe Boxes   Office Supplies   Security Locks   Cleaning ProductsKids   Baby Strollers   Child Car Seats   Remote ControlledTravel   Luggages & Bags   Airlines Seats   Hotel Rooms   Fun Trips   Cruise Ships   Mexico Tours