943 views
1 1 vote

According to the solution, there is no error in the program. And I ran the program there is no error. But how the rank is declared as int and initialized by 10.3 which is float. So, there should be a semantic error.

1 Answer

Best answer
1 1 vote
No, there is no error in the code.

As rank has integer data type and initialized to 10.3

so, It will contain 10. Semantic error basically check weather the variable is declared or not before initialization.
• selected by
Position:
Show:

Related questions

0 0 votes
0 0 answers
668
668 views
Jyoti Kumari97 asked Jan 29, 2019
668 views
I am having difficulty in finding the type of errors like if given a statement, if I have to tell which type of error it is ( syntax or semantic). Can anyone help me with...
10 10 votes
4 4 answers
2.1k
2.1k views
gatecse asked Feb 23
2,077 views
Consider the following C statements:char *str1 = "Hello; /* Statement S1 */ char *str2 = "Hello;"; /* Statement S2 */ int *str3 = "Hello"; /* Statement S3 */Which of the ...
0 0 votes
0 0 answers
279
279 views
Shubham Sharma 2 asked Sep 9, 2025
279 views
Arrange the following phases of a compiler as per their order of execution (start to end)Target code generationSyntax AnalysisCode optimizationSemantic AnalysisLexical An...
23 23 votes
6 6 answers
12.2k
12.2k views
Arjun asked Feb 16, 2024
12,176 views
​​​Consider the following two sets:$$\begin{array}{|ll|ll|}\hline & \textbf{Set X} & & \textbf{Set Y} \\\hline \text{ P.} & \text{Lexical Analyzer } & \text{1.}& \text...