Home » C Programming » Data Types » Question
  1. 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 ;
    }
    1. Suspicious pointer conversion
    2. Floating point formats not linked
    3. Cannot use scanf ( ) for structures
    4. 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 */
}



Your comments will be displayed only after manual approval.