Computer Programming I: Grammar and Basic Elements of C Language Year 2020-2021
Computer Programming I: Grammar and Basic Elements of C Language Year 2020-2021
Lecture 2
Grammar and basic elements of C language
Year 2020-2021
Objectives
1. Define the following concepts
• Data type
• Identifier
• Variable
• Constant
• Operator
• Expression
2. Study the data types and their features (size, range, memory allocation)
3. Get to know the operators and the data types they operate upon
4. Choose the suitable data type for each variable or constant in a program
5. Declare variables and constants
6. Display data with different formats
#define NUM_STUDENTS 20
#define PI 3.14159F
#define LETTER_A 'A'
Correct inputs?
• Input line • Function call
25 54.32e-1 Pedro scanf ("%d", &a);
scanf ("%d %f %s", &a, &x, n);
• Require:
#include <ctype.h>
Computer Programming I Lecture 2 45
References
• Brian W. Kernighan & Dennis M. Ritchie, The C Programming
Language, 1995, Prentice Hall.
• Manuel Caeiro Rodríguez, Enrique Costa Montenegro, Ubaldo
García Palomares, Cristina López Bravo, J, Practicar
Programación en C, 2014, Andavira.
• Learn C Programming,
https://www.tutorialspoint.com/cprogramming/
• Learn C Programming,
https://www.programiz.com/c-programming
• Stephen G. Kochan, Programming in C, 2014, Addison Wesley.
Computer Programming I Lecture 2 46