Hot Downloads

Welcome, Guest
Username: Password: Remember me

TOPIC: What is a prototype?

What is a prototype? 8 years 2 months ago #27555

  • ardeef
  • ardeef's Avatar
  • Offline
  • Frequent Member
  • Posts: 23
  • Karma: 0
Hi!

I cant find a more appropriate place to post my question, but just in case you want to reply. I was reading a programming book and came accross with the word prototype in the usage of a printf() function.that is, the prototype of printf() is:

boolean printf(string format [, mixed args])

but in the example,

printf("I am %d years old.", 25);

i cant see now the boolean. why there is a need to put boolean in the prototype but in actual, you really dont need to put it.

My understanding about prototype is that, it is a format that need to follow to avoid syntax error.

Please enlighten me.
The administrator has disabled public write access.

Re: What is a prototype? 8 years 2 months ago #27556

  • KiLLaBeE
  • KiLLaBeE's Avatar
  • Offline
  • Expert Member
  • Posts: 466
  • Karma: 0
You can also think of a prototype in the context of programming as a "template," and "template" tells you what to supply the function with, and what to expect in return. The "template" basically gives you an idea of how to make the function work.

printf(), being a function, has inputs that it can take in, and has an output that it can put out. As observed, the words within () in the printf function define what inputs the printf function can take in, and boolean defines what kind of output the printf function can output.

Because the printf function is so widely used in programming examples, it's not difficult to understand how it operates and how to use it...you should mostly concern yourself with the input and output parameters of functions that you're not familiar with because if you don't supply the functions with the correct inputs, or you don't define the correct output that they should output, they may not work or work incorrectly.

I'm guessing that you just started your programming book...if so, when you start learning about functions and how to make them, you'll better understand.
The administrator has disabled public write access.
Time to create page: 0.077 seconds

CCENT/CCNA

Cisco Routers

  • SSL WebVPN
  • Securing Routers
  • Policy Based Routing
  • Router on-a-Stick

VPN Security

  • Understand DMVPN
  • GRE/IPSec Configuration
  • Site-to-Site IPSec VPN
  • IPSec Modes

Cisco Help

  • VPN Client Windows 8
  • VPN Client Windows 7
  • CCP Display Problem
  • Cisco Support App.

Windows 2012

  • New Features
  • Licensing
  • Hyper-V / VDI
  • Install Hyper-V

Linux

  • File Permissions
  • Webmin
  • Groups - Users
  • Samba Setup