answersLogoWhite

0


Best Answer

Sure:

int main (void) { puts ("Hello, world"); return 0; }

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Can you write a program without defining the function prototype?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

What is prototype in C language?

A prototype in C is the declaration of a function. Without a prototype, the function cannot be called because the compiler would have no way of knowing if the function was being called correctly. Prototypes may appear in multiple translation units but can only be defined once. A definition is itself a prototype.


What is difference function prototype and function define in turbo c?

In C, a function prototype is a declaration to the compiler that a certain function exists, without a full definition. This allows other functions to call that function. The linker will later make sure that a function definition actually exists (perhaps somewhere else), and will turn the call to the function to a call to the correct function.


Write a Program to convert decimal number into hexadecimal no without using function and string?

This is not a question.


What is a function prototype in C and C plus plus?

A function prototype is basically a definition for a function. It is structured in the same way that a normal function is structured, except instead of containing code, the prototype ends in a semicolon.Normally, the C compiler will make a single pass over each file you compile. If it encounters a call to a function that it has not yet been defined, the compiler has no idea what to do and throws an error. This can be solved in one of two ways.The first is to restructure your program so that all functions appear only before they are called in another function.The second solution is to write a function prototype at the beginning of the file. This will ensure that the C compiler reads and processes the function definition before there's a chance that the function will be called.For example, let's take a look at a few functions form a linked list implementation.// Sample structuresstruct linked_list_node {int data;struct linked_list_node *next;};struct linked_list {int size;struct linked_list_node *root;};// Function Prototypesvoid deleteLinkedList(struct linked_list *list);void deleteNodes(struct linked_list_node *node);// Actual functions:// deletes the given linked listvoid deleteLinkedList(struct linked_list *list) {if( list != NULL ) {// delete nodesdeleteNodes(list->root);// lose the pointerlist->root = NULL;// delete actual listfree(list);}}// deletes all nodes starting at nodevoid deleteNodes(struct linked_list_node *node) {if( node != NULL ) {// deallocate next, if it existsif( node->next != NULL ) {deleteNodes(node->next);// lose the pointernode->next = NULL;}// deallocate nodefree(node);}}


What is the following warning in a function where msg is a function name without prototype?

In C, each function needs a prototype declaration in the header file so that it can be called from outside of its immediate domain. To speed up compiling, the compiler only looks in the header files for function declarations. This greatly speeds up compiling when the function being called is located in another file. This way, it doesn't have to scan the whole file to make sure you didn't make a mistake. All you need to do to clear this error is to include a function prototype in the header. I'm not sure about C, but you *might* be able to get away with declaring the function at the beginning of the .c file. Example: --(file helloworld.h)-- long msg(int, int, char *); //this is the prototype --(file helloworld.c)-- #include "helloworld.h" void main() { msg(1,5,"Hello World"); } long msg(int x, int y, char *message) { //code to display message here } Notice that the prototype only needs the data types, and not the variable names. If you don't want to bother with a header file, you can try putting your declarations at the beginning of your .c file (after the preprocessor directives), I know I've done it that way before but I'm not sure in which cases it will work.

Related questions

Can you write a program without specifying the prototype of any function?

You can write a program without specifying its prototype when the function returns an integer.If the prototype is not mentioned the compiler thinks that the return type of the function used is integer.When making program which return integer you can ignore writing the protoype.


What is prototype in C language?

A prototype in C is the declaration of a function. Without a prototype, the function cannot be called because the compiler would have no way of knowing if the function was being called correctly. Prototypes may appear in multiple translation units but can only be defined once. A definition is itself a prototype.


What is difference function prototype and function define in turbo c?

In C, a function prototype is a declaration to the compiler that a certain function exists, without a full definition. This allows other functions to call that function. The linker will later make sure that a function definition actually exists (perhaps somewhere else), and will turn the call to the function to a call to the correct function.


Can we execute java program without main function?

no


Write a program in C without any functions?

It is not possible. In C, any program must have at least one function to be able to compile and execute properly: the function main()


What is the importance of using functions in a c program?

C programs do not function without functions.


A c program to call a function without using function name?

It can be done via its address, for example: void function (void (*callback)(void)) { (*callback)(); }


Can you write a program without using any semicolon inside the main function?

not possible dude


Write a Program to convert decimal number into hexadecimal no without using function and string?

This is not a question.


How can you find a program in Windows 7 without browsing through the program list in the Start Menu?

Use the 'search' function in the Start menu.


Sorting an array in PHP without using sort function?

plz as soon as possible give me the program for shorting an array in asscending order without using any sort function in c++


What is the importance of functions in a c plus plus program?

Functions are very important in C++, as you can't write the simplest program to print hello without using a function. Overall you can say that function are building blocks of a C++ program. Functions can also be defined by the programmer to reduce program size.