Language Selection

English French German Italian Portuguese Spanish

C/C++ Programming/Development

Filed under
Development
  • How to pass a struct to a function in C

    A structure has been widely used as a user-defined data type in the C language. The purpose of using structures in C is to create a single data type that would be used further to group various data type variables or elements into one type. The structure has been used as a global variable so all the functions can access it easily. This means it can’t be declared in the main method so that we can use it anywhere.

  • C++ String Reverse

    If the string, “vwxyz“, is reproduced in the new order as, “zyxwv“.

    Then the string has been reversed. Unfortunately, such direct reversibility is not possible in C++. However, there is a classical workaround for reversing a string in C++. Keep reading this article to know-how.

    A string can be created in two main ways in C++. A string can be created as a constant pointer to a sequence of characters. A string can also be created by instantiating a string object from the string class. This article deals with string objects instantiated from the string class. This means the string library has to be included in order to execute the code samples in this article.

    A string object is a data structure where the string literal is a list. Each character is of one element in the list. And so, a literal string can be handled like an array of elements.

    This article explains the classical workaround to reverse a string in C++. This essentially iterates the string literal, backward. Having a summary knowledge of forward iteration enables the reader to understand reverse iteration better. This article deals with string objects instantiated from the string class.

  • C++ String starts with

    There comes a time when the programmer has to know what a string starts with. This knowledge can be used to choose or eliminate items in a list of characters. So, a programmer may want to know if a string starts with a particular character or with a particular sub-string. A programmer can write code that will check the initial characters of a string, one-by-one, and compare that with a prefix sub-string. However, all the strategies involved have already been done by the C++ string library.

    The C++ string class of the string library has the member function, starts_with(). This does the work for the programmer, but the programmer needs to know how to use the function. And that is why this tutorial is being produced. There are three variants of the string starts_with() member function. Variants of the same function are called overloaded functions.

    The basic approach for the start_with() member function is to compare a short independent sub-string with the first short segment of the string in question. If they are the same, then the function returns true. If they are different, the function returns false.

  • Function Overloading in C

    Function overloading is a very well-known concept used in object-oriented languages having many functions with the same name and different parameters in a single code. The object-oriented programming languages which support function overloading include Java and C++. As the C compiler doesn’t allow it to be used in the code hence, it isn’t easy to implement function overloading in C. Yet; we can still achieve the same thing with some technique. Let’s start this article with the opening of the shell terminal of Ubuntu 20.04 LTS.

More in Tux Machines

today's howtos

  • So this is why Deepin requires so much disk space for installation – LinuxBSDos.com

    Deepin is a desktop Linux distribution with roots in China. It is based on Debian, but ships with its own graphical interface called Deepin Desktop Environment and a set of Deepin-developed tools to go with it. The last version I installed was from 2015, so since I’m gradually coming back to writing for this blog, I decided to test drive the latest edition – Deepin 20.3, which was released on Nov. 25. For me that means installing it in a virtual environment using VirtualBox. For such installations I typically assign the virtual disk 20GB of disk space. And so it was with Deepin 20.3. But that didn’t end well because at some point the installation failed, with the message shown in Figure 2: “You need at least 64 GB of disk space to install Deepin. To get better performance, 128 GB.”

  • 13 exercises to boost your Linux skills | Enable Sysadmin

    Work through this Linux fundamentals checklist to make sure you're ready for whatever comes your way at home, at work, or on certification exams.

  • BASH 01 - Script Basics | Linux.org

    This article is the first in a series of articles to cover Bash Scripting. More articles will follow which will build on each other, so make sure you look over each article. It is preferable to read the articles in order (which is why I will number them). Scripting is a very useful ability for someone using Linux. Making scripts is especially useful for Administrators. Everyone should benefit from Bash Scripting. Bash is the most common shell interpreter on Linux systems. When you open a Terminal, you are in an interactive shell environment. To verify that your system is using the Bash shell using the command: 'echo "$SHELL"'.

  • What’s the Difference Between Exposing and Publishing a Docker Port? – CloudSavvy IT

    Exposed and Published container ports are two different but related concepts in Docker. Exposed ports are defined in your Dockerfile as simple metadata. You must publish them when your container starts if you want to enable outside access.

  • How to set up high-refresh rate monitors on Linux

    Do you have a high refresh rate monitor? Are you running Linux? Can’t quite figure out how to change the refresh rate? We can help! Follow along with this guide as we go over how to change the refresh rate on popular Linux desktop environments!

  • How to Install pgAdmin 4 on CentOS 8 – NextGenTips

    In this tutorial guide, I will be taking through the installation of pgAdmin 4 version 6.2 on CentOS 8 pgAdmin 4 is a free and open-source management tool for Postgres. Its desktop runtime written in NWjs allows it to run standalone for individual users, or the web applications code may be directly deployed on a web server for use by the web browser. pgAdmin 4 is a complete rewrite of pgAdmin, built using Python and Java.

  • How to Update to MATE Desktop 1.26 on Ubuntu 21.04

    Ubuntu MATE is a more retrospective version of Ubuntu, one that largely lets you continue using Ubuntu in the way it functioned over a decade ago. But despite how things may look, updates do continue to roll out for the MATE desktop environment that is Ubuntu MATE's namesake. The latest iteration is MATE 1.26. Here's how you can update the MATE desktop in Ubuntu 21.04 to the latest version.

  • How to Change a Users Shell in Linux - Unixcop the Unix / Linux the admins deams

    In this tutorial, we will show you how to change the shell of a user in Linux. The shell is a program that accepts and interprets commands. there are several shells such as bash, sh, ksh, zsh, fish and many other lesser known shells available on Linux. Bash is a Unix shell and command language for the GNU Project as a free software replacement for the Bourne shell. First released in 1989,it has been used as the default login shell for most Linux distributions.

  • How to use shutdown command with examples - Unixcop the Unix / Linux the admins deams

    “Shutdown” refers to the process of stopping and shutting down a computer or server. This involves cutting the power to the main components of the system using a controlled process. Applications are closed, active processes and protocols are saved to the hard drive, device drivers are removed, and user settings are saved in the process. There are several options to do so, including scheduling a shutdown at a specific time, shutting down immediately, broadcasting a unique message, and so on.

  • How to Install MySQL Database on Ubuntu 20.04 | RoseHosting

    MySQL is an open-source relational database management system (RDBMS), it’s widely used and part of the popular LAMP/LEMP stacks. The data is organized in one or more tables in which the data types may be related to each other and MySQL uses SQL Structured Query Language to manage its data. Considering its part of the LAMP/LEMP stack it is used by many database-driven web applications such as WordPress, Magento, Drupal, and Joomla. Today we will install MySQL on our server and create a database and user with chosen permissions on this database, let’s get started!

  • How to install deepin 20.3 - Invidious

    In this video, I am going to show how to install deepin 20.3

Dockeye - New Graphical App to Manage Docker Containers / Images in Linux

Running applications via Docker in Ubuntu Linux? Dockeye is a free open-source tool to manage your containers and images via a graphical user interface. Dockeye is written in Rust programming language. It provides a dark UI (light mode is also available) that list Docker containers and images in tabs. For each container, it provides options to control start, stop, pause, and remove operations. User may also check the detailed information about a container, including ID, image, maintainer, labels, environment, network info, CPU, Memory and other system resource usage. And, app running log is available in tab for debugging purpose. Read more

Raspberry Pi CM4-based panel PC offers DAQ inputs and M.2 NVMe

Sensoper’s 7-inch “SC-PC” HMI panel PC runs Linux on a Raspberry Pi CM4 and supplies GbE, M.2 for NVMe, RS-485, 3x USB, 8x digital inputs, 7x transistor outputs, and 8x analog inputs with a choice of 0-10V or 4-20mA ranges. Michigan-based Sensoper Controls has launched a 7-inch, industrial panel-PC in two variants: an SC-PC-AV8-TO7 model with 8x 0-10V analog inputs and an SC-PC-AM8-TO7 with 4-20mA analog inputs. The otherwise identical panel PCs run Raspbian (Raspberry Pi OS) Linux with pre-installed Node-RED on the Raspberry Pi Compute Module 4. Read more

Android Leftovers