-
Which error are you likely to get when you run the following program in TC/TC++?
#include <stdio.h>
int main ( )
{
struct emp
{
char name[20];
float sal;
};
struct emp e[10];
int i ;
for (i = 0; i <= 9; i++)
{
printf ("Enter name and salary : ");
scanf ("%s %f" , e[ i ].name, &e[ i ].sal);
}
return 0 ;
}
-
- Suspicious pointer conversion
- Floating point formats not linked
- Cannot use scanf ( ) for structures
- Strings cannot be nested inside structures
Correct Option: B
Floating point formats not linked
Just add the following function in your program. It will force the compiler to include required libraries for handling floating point linkages.
static void force_fpf() /* A dummy function */
{
float x, *y; /* Just declares two variables */
y = &x; /* Forces linkage of FP formats */
x = *y; /* Suppress warning message about x */
}