PDR: C Tutorial for C++ programmers

submited by
Style Pass
2024-10-11 12:30:05

This document assumes that you have a strong working knowledge of the most basic and important aspects of C++. It is designed to introduce you to important concepts in C - most of them also available in C++, but rarely used there - with which you likely have little familiarity.

A few things to note about this program: - The <stdio.h> was #included (stdio stands for Standard I/O library), which is where printf() (and, later, scanf()) live. These are the basic input and output routines in C, analogous to cout and cin in C++. More on these functions are below - There are no namespaces in C

To use malloc(), which is the C version of new, you will need to include the <stdlib.h> file (stdlib is the standard library) - more on malloc() is also below.

C does not have iostreams or stream operators, such as << (for cout) and >> (for cin). For most I/O, we use the printf() family of functions (for output) and the scanf() family (for input).

Leave a Comment