0

Some function programmes prototype declared firsly but some programmes there has no function declaration but function is present

in c programming what is the rule of function declaration? please describe

9th Feb 2018, 2:08 AM
ajmal yousuf
ajmal yousuf - avatar
1 Odpowiedź
0
In C you can ‘prototype’ a function at the start of the file letting the compiler know that it exists and then define/implement it at the end of the file like so: int add(int x, int y); // function prototype int main() { int a = add(4, 54); } int add(int x, int y) { // implementation return x + y; } But you can also obviously just put the whole function at the top
2nd Mar 2018, 10:03 PM
TurtleShell
TurtleShell - avatar