Difficulty: Easy
Correct Answer: No error
Explanation:
Introduction / Context:This question checks whether the given structure definition, array usage, and scanf calls are valid in standard C, independent of any toolchain-specific linker quirks.
Given Data / Assumptions:
Concept / Approach:In standard C, reading a string into a char array with %s (no width limit though) and a float with %f (address passed) is valid. The code shows &e[i].sal, which is correct because %f expects float* for scanf. There is no language-level error with the struct layout or the loop bounds (i from 0 to 9 covers 10 elements).
Step-by-Step Solution:
1) Check members: name is a char array; sal is float — valid.2) e is an array of struct emp of size 10 — valid.3) scanf("%s %f", e[i].name, &e[i].sal); — types match the format.4) The code compiles and runs in standard C.Verification / Alternative check:Compile with a modern compiler (e.g., gcc/clang). Input sample names/salaries; values populate correctly. Adding a field width to %s (e.g., "%19s") is recommended to prevent overflow but not required for compilation.
Why Other Options Are Wrong:
Common Pitfalls:Forgetting the & for non-array scalars in scanf, omitting width limits for %s, or assuming toolchain quirks are language errors.
Final Answer:No error
Discussion & Comments