Find the syntax error from the following program. Justify each error.
2
#include<iostream.h>
void display (float p)
cout<<' The argument is' <<p;
void main ( )
float q = 11.1;
display (p);
Answers
Answered by
2
Scope and Parameter passing errors are present in this code.
Explanation:
I have mentioned all the errors line by line:
1. when a method or function is declared it should be contained within a block. Use of braces will help to maintain a block of code.
2. When a statement is written in the output it should be contained withing double quotations otherwise it will through an error.
3. The main must contain return type 'int' and the codes written inside it must be within the braces.
4. As a function is called then the declared parameter should be passed and that parameter should be declared inside the scope.
Similar questions