Professional Documents
Culture Documents
25.
Logical Expressions
In C, logical false is reresented by any zero value and true by any nonzero value. Here is
a list of operators
1. and::="&&".
2. or::="||",
3. not::="!",
Conditional Expressions
30. conditional_expression::=logical_OR_expression | logical_OR_expression "?"
expression ":" conditional_expression,
Assignment Statements
31. assignment_expression::=S(unary_expression, assignment_operator),
32. assignment_operator::="=" | "*=" | "/=" | "%=" | "+=" | "<<=" | ">>=" | "&=" | "^=" | "|
=",
33. expression::=List(assignment_expression ),
34. constant_expression::=conditional_expression,
2. declarator_list::=List(declarator_initialized),
Types
5. type_specifier::="void" | "char" | "short" | "int" | "long" | "float" | "double" | "signed" |
"unsigned" | struct_union_specifier | enumeration_specifier | typedef_name,
6. type-qualifier::="const" | "volatile",
7. typedef_name::=identifier,
Initialization
8. initializer::=assignment_expression | initializer_list,
9. initializer_list::=List(initializer),
12. structure_declarator_list::=List(structure_declarator),
Enums
16. enumeration_value::=enumeration_constant ("=" constant_expression|)
17. enumeration_list::=List(enumeration_value ),
Functions
19. function_definition::=declaration_specifier declarator | declaration_list |
compound_statement,
20. parameter_declaration::=#declaration_specifier declarator | abstract_declarator,
Main Function
A complete C program has to have a function with name 'main'. This is the function
called by the operating system. It must return an int value indicating whether the prograam executed
correctly or if there was an error. In UNIX, the main program returns 0 to indicate no errors. Their
are several valid forms:
22. int main()
23. int main(argc, argv)
24. int main(argc, argv, envp) The parameters are set up by the operating system when the
program starts. The traditional arg stands for argument.
Pointers
25. pointer::=#( "*" | #type_qualifier),
3. header_name::=#(header_char),
4. new_line::=new_line character,
7. endif_line::="#endif" new_line,
8. elif_group::="#elif" constant_expression new_line pp_group,
13. pp_group::=#(pp_part),
End
Parman
go to
budi
luhur
Parman
go to
budi
luhur