playground/c/grammar-comment-like.c

22 lines
488 B
C

/* https://en.wikipedia.org/wiki/Maximal_munch */
#include<stdio.h>
int main() {
int a=2, *ptr=&a, b;
//b = 2/*ptr;
/*
grammar-comment-like.c: In function 'main':
grammar-comment-like.c:13:12: error: invalid type argument of unary '*' (have 'int')
b = 2/(*a);
^~
2
Press ENTER or type command to continue
grammar-comment-like.c: In function 'main':
grammar-comment-like.c:12:1: error: expected ';' before '}' token
}
^
*/
b = 2/ *ptr; // This is okay.
}