Fundamentos de Programação

Base Knowledge

No recommended basic knowledge.

Teaching Methodologies

In this curricular unit, the following teaching methodologies are used:

1 – Expository method: explanatory method where theoretical foundations and concept are presented by the teacher and discussed with the class, followed by demonstrative examples;

2 – Experimental method: active method where the student develops knowledge by solving problems and developing individual laboratory projects or in group dynamics.

Learning Results

At the end of the course the student should be able to:

1. Identify and classify the different types of programming languages. Compare and analyze its main features. Justify the need for compilers and illustrate their use.

2. Define algorithm. Indicate and analyze the approaches used to describe algorithms. Build solutions using algorithms, flowcharts and pseudo-code.

3. Analyze the main features of the C language. Explain the normalization path of this language. Discuss the development cycle and structure of a C program.

4. Classify the different types of data in the C language. Discuss the various types and formats of variables. Illustrate the creation, initialization and modification of variables. Demonstrate and justify the use of casting between variables.

5. Explain conditional and unconditional flow control. Identify the different types of decision-making conditional control structures. Justify the representation of logical values. Illustrate the application and precedence of logical and relational operators. Create programs that demonstrate the use of tests and conditions.

6. Identify the different structures available for interactive conditional control. Justify the use of operators and assignments for code optimization. Identify scenarios and uses for infinite cycles. Create programs that demonstrate the use of cycles.

7. Define functions. Classify the types of functions. Identify the main predefined functions. Explain the syntax of a function. Demonstrate the use of multiple files. Create programs that exemplify the functioning and usefulness of functions.

8. Explain the concept of array. Classify the array types. Analyze how it is created, accessed and manipulated. Demonstrate how constants can be created. Define String. Identify how it is created, accessed and manipulated. Create programs that make use of arrays and strings.

9. Define files. Compare files with streams. Classify file and stream types. Analyze the different operations associated with files. Discuss opening modes. Summarize the existent solutions to delimit the end-of-file. Demonstrate the passage of parameters through the command line. Create programs that read from and write to files.

10. Analyze the operation of the preprocessor. Explain the concept of directives. Classify the different types of directives. Illustrate how to obtain the results produced by the preprocessor. Create programs that demonstrate the use of various types of directives.

Program

1. Programming languages. Language types. Low-level languages. Assembly language. High-level languages. Structured languages. Object-oriented languages. Data types, control structures (sequential, selection, repetition). Compilers (gcc) and assemblers.

2. Introduction to algorithms: flowcharts and pseudo-code. Definitions. Declaring variables and assigning values. Arithmetic, relational and logical operators. Conditional branch command. Repeat commands.

3. C programming language. Characteristics. Standardization (K&R C, ANSI C, C18). Development cycle: source code, preprocessor, compilation, linking, execution. Structure of a C program: #include, main(), blocks, comments (/* */, //).

4. Data types. Variables: definition, type, nomenclature, declaration, assignment, arithmetic. Integer variables: types (short, long, signed, unsigned), format. printf() and scanf() functions. Real variables: IEEE 754 standard, types, format. Characters: types, format. Casting: implicit, explicit.

5. Tests and Conditions. Logical Values. Relational Operators (<, <=, >, >=, ==, !=). Logical Operators (!, &&, ||). Operator Precedence. Conditional flow control. if…else statement: indentation, statement blocks, chained statements. Switch statement. Unconditional flow control: break.

6. Cycles. Optimization: increment/decrement operators (++, –), assignment operators (+=, -=). Iterative conditional flow control: while, for, do…while. Infinite Cycles. Unconditional flow control: continue.

7. Functions. Function types: predefined (stdio.h, string.h), user defined. Syntax: return type, name, parameters, body, return. Local variables. Function position: prototype. Multiple Files: header files (.h). Passing parameters by value and by reference.

8. Arrays. Definition. Classification: one-dimensional, multidimensional. Declaration, initialization and access to elements. Passing arrays to a function. Constants: #define, const. Strings: declaration, initialization, reading and writing (printf, puts, scanf, gets). Functions for manipulating strings.

9. Files. Definition. Stream types: stdin, stdout, stderr. File types: binary, text (EOL: n, nr). Operations: opening, reading, writing, closing. Opening modes: r, w, a, r+, w+, a+, b. EOF macro and end-of-file function (feof()). Passing arguments through the command line (argc(), argv()).

10. Preprocessor. Directives. Macro expansion: #define, user-defined macros (constant-like, function-like), predefined macros, operators (, #, ##). File inclusion: #include. Conditional compilation.

Curricular Unit Teachers

Grading Methods

Evaluation
  • - Theoretical-practical part with the completion of an exam or two written tests and a practical part with the completion of a final work. - 100.0%

Internship(s)

NAO

Bibliography

Damas, L. (1999). Linguagem C (24th ed.). FCA.

Gustedt, J. (2019). Modern C. Manning Publications.

King, K. N. (2008). C Programming: A Modern Approach, 2nd Edition (2nd ed.). W. W. Norton & Company.

Perry, G., & Miller, D. (2013). C Programming Absolute Beginner’s Guide (3rd ed.). Que Publishing.

Rocha, A. (2006). Introdução à programação usando C. FCA.