4.The following EBNF rules describe the syntax of decimal integer constants in C
ID: 3758033 • Letter: 4
Question
4.The following EBNF rules describe the syntax of decimal integer constants in C99. Write a single Perl pattern that matches these constants. Simplify your pattern as much as possible.
integer-constant:
decimal-constant integer-suffixopt decimal-
constant:
nonzero-digit
decimal-constant digit
integer-suffix:
unsigned-suffix long-suffixopt unsigned-
suffix long-long-suffix
long-suffix unsigned-suffixopt
long-long-suffix unsigned-suffixopt
unsigned-suffix: one of
u U
long-suffix: one of
l L
long-long-suffix: one of
ll LL
Explanation / Answer
#include <stdio.h>
/* print the numbers from 1 to 10 */
int
main(int argc, char **argv)
{
int i;
puts("Now I will count from 1 to 10");
for(i = 1; i <= 10; i++) {
printf("%d ", i);
}
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.