Q:

Error: expected \'=\', \',\', \',\' \'asm\' or \' _attribute_\' before \'<\' token in C

0

Error: expected '=', ',', ',' 'asm' or ' _attribute_' before '<' token in C

A very common error in C programming language, it occurs when # is not used before the include.

As we know that #include is a preprocessor directive and it is used to include a header file's code to the program. But, include is nothing without #, it is not valid and it cannot be used to include a header file in the program.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Example:

include <stdio.h>

int main(void) {
	printf("Hello world!");
	return 0;
}

Output

prog.c:1:9: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘<’ token
 include <stdio.h>
         ^

How to fix?

To fix this error - use #include.

Correct code:

#include <stdio.h>

int main(void) {
	printf("Hello world!");
	return 0;
}

Output

Hello world!

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now