Computer Science, asked by tannynaik003, 9 months ago

Write error message given by C compiler during program compilation, if you don't use & sign in scanf statement.​

Answers

Answered by SushmitaAhluwalia
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