Write error message given by C compiler during program compilation, if you don't use & sign in scanf statement.
Answers
Answered by
12
Error message given by C compiler during program compilation, if '&' sign is missed in scanf statement:
Program:
#include<stdio.h>
void main()
{
char S;
printf("Enter your name:");
scanf("%s",S);
}
- In the above program, S is variable with character data type.
- printf is used to print the string given in quotes.
- scanf is used to read the character.
- %s is format specifier for string.
- When the above program is run, the compiler shows error displaying "Invalid syntax" as we did not use '&' sign before S which is supposed to point to the variable.
Similar questions
Social Sciences,
5 months ago
Sociology,
5 months ago
Math,
5 months ago
English,
9 months ago
Physics,
9 months ago
Social Sciences,
1 year ago
Math,
1 year ago