GATE CSE
First time here? Checkout the FAQ!
x
0 votes
79 views

What is the type of error (earliest phase) identified during the compilation of the following program ?
 

#include <stdio.h>
main( )
{
   int x, y, z;
   x = y = z = 10.3;
   printf(“%c”, x);
}

 

asked in Compiler Design by Boss (6.5k points) 8 113 247
edited by | 79 views
  • No lexical error
  • No syntax error
  • Semantic error Reported
Why Semantic Error ?

In C, It will be typecasted as $x = y = z = 10$, and ASCII character corresponding $10$ will be printed. So, no problem in C.

But it would cause semantic error if it $x,y$ and $z$ were initialized as floats. rt??
Ya implicit type conversion is available in C..So no issue in C..But in languages which it does not support this feature..So there problem will come in type checking which is a part of semantic analysis phase..
yes, it will be error because it want to print int value in %c

Please log in or register to answer this question.

Related questions

+1 vote
1 answer
1
asked in Compiler Design by vaishali jhalani Boss (6.5k points) 8 113 247 | 51 views
+4 votes
2 answers
2
asked in Compiler Design by shubhams3 (89 points) 1 3 | 267 views
0 votes
0 answers
3
asked ago in Compiler Design by rahul sharma 5 Veteran (14.9k points) 12 103 310 | 40 views


Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
Top Users Oct 2017
  1. Arjun

    23242 Points

  2. Bikram

    17048 Points

  3. Habibkhan

    7096 Points

  4. srestha

    6012 Points

  5. Debashish Deka

    5430 Points

  6. jothee

    4928 Points

  7. Sachin Mittal 1

    4762 Points

  8. joshi_nitish

    4278 Points

  9. sushmita

    3954 Points

  10. Rishi yadav

    3744 Points


Recent Badges

Popular Question Ml_Nlp
Notable Question set2018
Notable Question rahul sharma 5
Notable Question Sanjay Sharma
Notable Question Lakshman Patel RJIT
Popular Question makhdoom ghaya
Popular Question Çșȇ ʛấẗẻ
Reader kenzou
Popular Question mystylecse
Notable Question Sanjay Sharma
27,262 questions
35,076 answers
83,760 comments
33,185 users