TAILIEUCHUNG - C for Dummies 2nd edition phần 8

chức năng giống như một máy tính. Mặc dù khoảng trống không làm chức năng mà có thể bạn đã đọc trong các chương trước vẫn còn giá trị chức năng, giá trị thực sự trong một chức năng là có làm điều gì đó. Tôi có nghĩa là, chức năng phải nhai một cái gì đó và nhổ nó ra. | 274 Part IV C Level Chapter 22 Functions That Actually Funct Jn This Chapter Sending a value to a function Sending multiple values to a function Using the return keyword Understanding the main function Writing tighter code function is like a machine. Although the do-nothing void functions that you probably have read about in earlier chapters are still valid functions the real value in a function is having it do something. I mean functions must chew on something and spit it out. Real meat-grinder stuff. Functions that funct. This chapter explains how functions can be used to manipulate or produce information. It s done by sending a value to a function or by having a function return a value. This chapter explains how all that kooky stuff works. Marching a Value Off to a Function Generally speaking you can write four types of functions Functions that work all by themselves not requiring any extra input These functions are described in previous chapters. Each one is a ho-hum function but often necessary and every bit a function as a function can be. Functions that take input and use it somehow These functions are passed values as either constants or variables which they chew on and then do something useful based on the value received. Functions that take input and produce output These functions receive something and give you something back in kind known as generating a value . For example a function that computed your weight based on your shoe size would swallow your shoe size and cough up your weight. So to speak. Input and output. 276 Part IV C Level Functions that produce only output These functions generate a value or string returning it to the program for example a function that may tell you where the Enterprise is in the Klingon Empire. You call the whereEnt function and it returns some galactic coordinates. Any function

TỪ KHÓA LIÊN QUAN
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.