• String library functions in C

    String library functions

    The string library in C provides functions to operate on strings. There are two kinds of string manipulation functions. Strings are terminated by the null character, and these functions use this characteristic while working on the given string. However, some library functions have a “number” version. They work on ...

  • Strings in C

    Strings

    A string is a sequence of characters. A string in the C language has the null character, ‘\0’, at the end. A string with zero characters has just the null character, ‘\0’.

    There are two kinds of strings in C. The first is the variable string. The contents of a variable string can change during ...

  • Program to find the day of the week for a given date

    1.0 Day of Week

    The Gregorian calendar was adopted in 1582. The formula to find the day of the week for any date after 1582 is,

    d = N + ⌊2.6M - 0.2⌋ + Y + ⌊Y/4⌋ + ⌊C/4⌋ - 2C 
        - (1 + L)⌊M/11⌋ (mod 7)
    

    where,
    d is ...

  • Flex Tutorial

    1.0 Flex and Bison

    Flex and Bison are software tools used for processing structured input. Flex stands for “fast lexical analyzer” and is used for scanning the input and breaking it into recognizable chunks of text, called tokens. A token, normally, ...

  • Process synchronization

    1.0 Problem

    Suppose there are n concurrent peer processes, where n > 1. All these processes have a checkpoint, which is an important point in the execution trace of the process. These processes need to be synchronized such that no process crosses its checkpoint before the others have reached their individual checkpoints. For example, a software ...

  • Regular Expressions in C

    Regular expressions are used for searching strings in text files. A regular expression is a string of characters and may contain certain metacharacters. A metacharacter has a special meaning. A regular expression denotes a set of strings. Or, in other words, there is a set of strings that are matched by it.

  • Dining philosophers problem

    The dining philosophers problem is about deadlock in concurrent systems. The dining philosophers problem is explained with example programs.

  • Program to generate a random password in C

    1.0 Introduction

    Passwords provide a level of security for digital assets. To be effective, passwords need to sufficiently long. random and chosen from a big underlying domain.In this post, we have a C-language program, that takes in number of characters in the password as input, and chooses a random password from printable ASCII characters. The program ...

  • C Programming Tutorial 5: Structures and Unions

    A structure, in the C programming language, is a collection of variables of various types, mostly for an entity. The variables are listed in a sequence and occupy consecutive locations in the memory. A union appears to be just like a structure as it has multiple variables listed in a sequence. However, at any time, ...

  • C Programming Tutorial 4: Pointers and Arrays

    Pointers and arrays are the most important concepts in the C programming language. The power of C comes from pointers; the ease with which pointers can be used to access parts of data structures and the established programming idioms related to pointers reiterate this point. As we shall see in this post, pointers and arrays ...

  • C Programming Tutorial 3: Control Flow Statements and Functions

    A C program comprises of global data and functions. A program must have a main function and the execution starts at the first statement in the main function. A function has local data and statements. The control flow deals with the order in which statements are executed by a program. In this post, we will ...

  • C Programming Tutorial 2: Data Types and Expressions

    Data is an important part of a program. In fact, programs are written so that data can be captured, processed, stored and presented to the user. The success of a program depends on how well data has been organized and used. In this post, we will be looking at data types and expressions in programming ...

  • C Programming Tutorial 1 – Getting Started

    C is a procedural programming language invented by Dennis Ritchie in 1972. C has been the most widely used programming language in the last fifty years. There are some unique features of C. It is a small language; so it can be easily ...

  • I/O multiplexing: select, poll and epoll in Linux

    I/O multiplexing

    I/O multiplexing is the the ability to perform I/O operations on multiple file descriptors. Input operations like read, accept and calls for receiving messages block when there is no incoming data. So, if an input call is made and it blocks, we may miss data from other file descriptors. To circumvent this, I/O multiplexing ...

  • POSIX real-time signals in Linux

    Signals

    Signals are notifications delivered asynchronously to a process by the kernel. Signals are grouped in two categories. First, there are standard signals, which have been there since the early days of Unix. Second, there are POSIX real-time signals which are specified in POSIX.1b, or, IEEE Std 1003.1b-1993, for Real-time Extensions for POSIX ...

Share