जॉइन Examsbook
722 0

प्र: What would be the output of the following program? main() {     extern int fun ( float );     int a;     a = fun ( 3. 14 );     printf ("%d", a); } int fun ( aa ) float aa ; {      return ( (int) aa ); }

  • उत्तर देखेंउत्तर छिपाएं
  • Workspace

उत्तर :
व्याख्या :

Error occurs because we have mixed the ANSI prototype with K & R style of function definition. When we use ANSI prototype for a function and pass a float to the function it is promoted to a double. When the function accepts this double into a float a type mismatch occurs hence the error. The remedy for this error could be to define the function as : int fun (float aa) {   .... }

क्या आपको यकीन है

  त्रुटि की रिपोर्ट करें

कृपया संदेश दर्ज करें
त्रुटि रिपोर्ट सफलतापूर्वक जमा हुई