QR code is the most famous way of encoding data which was first introduced in automotive industry and later gained popularity in other industries as well due to fast readability and storage capacity compared to bar codes.
The QR code is a image with black and white pixels inside a square box from which data can be extracted even though image is rotated and is readable in any direction making it interesting to know how the data is encoded and decoded.
How the Data is represented in QR code
In QR code data bits 0 and 1 are represented as black and white pixels .There are many QR code versions ranging from 1 to 40 a given version is 4 pixel larger than the previous version and can be selected based on maximum data which can be encoded and correction level . QR code with high correction level can be read if the QR code is partial and correction levels are L , M , Q and H .The link here gives the chart where we can select the QR code version based on input data.
Layout of QR code

1)Quiet zone: This is the layer with white pixels around the 3 black square boxes at the edges.
2)Finder patterns: The 3 large square blocks which is used to identify the angle and position contributing to 360 degree scanning .
3)Alignment : If the image is distorted i.e bent or viewed from a different angle ,this area defines the center of the QR code.
4)Timing pattern: This joins all the Finder patterns and timing pattern on it makes it easy to identify the individual data cells within a QR code and is especially useful when the code is damaged or distorted.
5)Version information: QR code version information is represented on these pixels which are above the end finder pattern’s.
6)Data cells: Cells other than all the above represent data.
Data to be encoded in the QR code is converted to binary format and the remaining empty bits are padded to fit the QR code version maximum bits . The QR code error correction is done using the Reed–Solomon error correction algorithm and then the data and the error code words are interleaved and then converted to a binary data and the blocks represented in the above image are formed in order and data is filled as shown in the image below

References:
https://www.thonky.com/qr-code-tutorial
FOSS QR code Libraries for Application
Data Encoding
You can refer to the project here which contains examples for using qr code library in C , C++ , Java and Python.
For C&C++ you can download the debian package to use the library to generate QR code
sudo apt-get install libqrcodegen-dev
Data Decoding
for decoding the QR code data this library can be used .
For C&C++ you can download the debian package to use the library to read QR code
sudo apt-get install libzbar-dev
