Programming fundamentals

Base Knowledge

There are none.

Teaching Methodologies

The course contents are presented through examples exposition.

Exercises are proposed to students so they can practice problem solving and better understand the contents.

Learning Results

  • Identify and classify the different types of programming languages. Distinguish programming paradigms. Compare and analyse its main features. Justify the need for compilers and illustrate their use.
  • Understand the algorithm concept. Define algorithm. Indicate and analyse the approaches used to describe algorithms. Build solutions using algorithms, flowcharts, and pseudo-code. Apply instructions and logical sequences in problem solving. Use rules and the different phases in the elaboration of an algorithm. Present algorithms in pseudocode. Understand the structure of flowcharts. Represent algorithms through flowcharts. Identify abstract data types. Enumerate and identify arithmetic, relational, and logical operators. Use control, selection, and repetition structures efficiently.
  • Analyse the main features of the C language. Explain the normalization path of this language. Discuss the development cycle and structure of a C program. 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.
  • 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.
  • 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.
  • Define functions. Classify the types of functions. Identify the main pre-defined functions. Explain the syntax of a function. Demonstrate the use of multiple files. Create programs that exemplify the functioning and usefulness of functions.
  • Explain the array concept. Classify the array types. Analyse 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 use arrays and strings.
  • Define files. Compare files with streams. Classify file and stream types. Analyse the different operations associated with text 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 text files.

Program

  1. Programming languages. Language types. Low-level languages and high-level languages. Structured languages and 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. Development cycle: source code, preprocessor, compilation, linking, execution. Structure of a C program: including libraries, main(), blocks, comments (/* */, //).
  4. Data types. Variables: definition, type, nomenclature, declaration, assignment, arithmetic. Integer variables: types (short, long, signed, unsigned), format. Writing and reading functions. Real numbers variables: IEEE 754 standard, types, format. Characters: types, format. Implicit and explicit casting.
  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 libraries’ functions), user defined. Syntax: return type, name, parameters, body, return. Local variables. Function position: prototype. 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. Functions for manipulating strings.
  9. Files. Definition. Stream types: stdin, stdout, stderr. Binary files and text files. Operations in files: opening, reading, writing, closing. Opening modes: r, w, a, r+, w+, a+, b. End of a file: EOF, feof()  function.

Curricular Unit Teachers

Internship(s)

NAO

Bibliography

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

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

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

Szuhay, J. (2020). Learn C programming: A beginner’s guide to learning C programming the easy and disciplined way. Packt publishing.