C – Page 2 – POFTUT

Category: C


strcmp() C Library Function Usage with Examples

C programming standard library provides strcmp() function in order to compare two strings and return the results whether they are identical or different. Syntax and Parameters As stated previously strcmp() function takes two char array or string arguments.

const char* str1 is the first string or char array which will be compared the second one. const is mainly used to prevent given char array pointer to be changed. const char* str2...


fgets() C Library Function Usage Examples To Read File

Standard C library provides the fgets() function to read a line from a specified stream where stream can be a file. fgets() function also used to read the specified number or size of the characters from the given string. In this tutorial, we will learn the usage of fgets()  function with its parameters with different examples. Syntax The syntax of the fgets()  function is very easy. there are only 3...


strchr – Find Character In A String C and C++ Tutorial with Examples

C library provides a lot of functions in order to use string or char array types. strchr() function is a very popular function which is used to find the first occurrence of a given character in a string or char array. Syntax and Parameters As strchr() provides the first occurrence of the given char it will return a pointer to the first occurrence.  We will also provide the string or char...


How To Generate Random Numbers with rand() and srand() Functions in C and C++?

C and C++ programming languages provide rand() and srand() functions in order to create random numbers. Random numbers can be used for security, lottery etc. In this tutorial we will learn how to use a random number generating functions rand() and srand() with their attributes and specialties. Random Numbers Random numbers are sequential numbers those are different than each other always. Random numbers are important for security which can be used to...


What is glibc Linux GNU C Library?

Linux provides a lot of opensource and free libraries to use operating system features easily. GNU is an opensource community which creates a lot of open source and free libraries. glibc is the short form of the GNU C Library. C Standard Library C programming language provides some standard libraries. The main standard library is named as C Standard Library which provides a lot of functions those defined in C...


Exec System Call For C and PHP Tutorial with Examples

exec() function is a function used to create and run processes in operating systems Linux, Windows and MacOS. exec() function has different useful variants like execve() , execl(), execlp() , execle() etc. General Syntax There are a lot of different exec() function variants.  Here are some of them syntax.

Example C Code During the exec()  function example we will use following C code for examples.

Compiling C Code...


How To Use Linux ldd Command To Print Shared Libraries with Examples?

Shared libraries are used to provide functions to the commands and executable of the Linux. ldd command can be used to list currently used shared libraries of given executable file. Help Even ldd command is a simple command which provide some parameters this can be listed with the –help option like below.

Print Given Executable Shared Libraries We will start with the basic usage where we will print given...

While Loop In Java, Javascript, C++, C#, Python Programming Languages 0

While Loop In Java, Javascript, C++, C#, Python Programming Languages

Programming languages like Javascript, C++, C#, Python provides while loops in order to iterate over the given list, array, set etc. while loop is a very important part of the programming language because of its functionality. In this tutorial, we will examine and compare while loop for programming languages like Javascript, C++, C#, and Python. Javascript while loop Javascript provides different syntax of while loops. The general syntax is like...


How To Read Input with fscanf() function In C Programming Language?

C programming language libraries provide some standard functions which can be used in different platforms like Linux and Windows. In this tutorial, we will learn how to use fscan()function, return values and parameters with examples. Declaration and Parameters fscanf() function will accept a file stream in FILE type and format specifiers as char type. In this case, format specifiers are important because the given file will be read in this format...


mmap Tutorial with Examples In C and C++ Programming Languages

As programmers we generally use malloc() , free() and similar functions in order to allocate memory. They are provided by glibc() library. The actual work is done by mmap() and munmap()which is a Linux systemcall. What Does mmap() Function? mmap() function or system call will create a mapping in the virtual meory of the current process.The address space consist of multiple pages and each page can be mapped some resource. We can create this mapping...

Enjoy this blog? Please spread the word :)