Difference between char [] and char * in C?

The first statement puts the literal string “mycplus” in read-only memory and copies the string to newly allocated memory on the stack. The second statement is known as static string allocation and definition. This statement places the string  “mycplus” in the read-only parts of the memory and making p_name  a pointer to that string.

Arrays as Data Structure in C/C++

As discussed in the previous post, there are two types of data structures available to C and C++ programmers. One is already built into the programming language such as arrays and structures. Other type of data structure is a bit complex in a sense that it can be...

Working with Pointers in C

A pointer is a variable that represents the location of a data item, such as a variable or an array element. Pointers are used frequently in C, as they have a number of useful applications. For example, pointers can be used to pass information back and forth between a function and its reference point. Pointers provide a way to return multiple data items from a function via function arguments to
be specified as arguments to a given function.

Arrays in C

What is an Array? In C Programming, an array can be defined as number of memory locations, each of which can store the same data type and which can be referenced through the same variable name. Arrays can be of two types i.e. One Dimensional Array (such as lists) and...

Dynamic array of integers

An object of class DynamicArrayOfInt acts like an array with unlimited size. The method put(position,value) is used to store the value at the specifed position in the array. There is no pre-set limit on how large position can be, although for very large values there...

Insertion in Arrays

How to insert an element in an array at any point. And then print the updated array 12345678910111213141516171819202122232425262728293031323334353637383940414243 /********************************************************     MYCPLUS Sample Code -...

Multiplication of Matrices

A program to find the multiplication of the given matrices [sourcecode=c]/******************************************************* * MYCPLUS Sample Code – https://www.mycplus.com * * * * This code is made available as a service to our * * visitors and is provided...

Simple operations with arrays

The following C programming code performs simple operations on arrays. It initializes an array by two different ways and prints out the result of the array initialization. 12345678910111213141516171819202122232425262728293031323334353637383940414243...

C Program to compare two integer arrays

This C program compares two distinct arrays and if the arrays are same then content results in FALSE. The behavior of comparison is explained when we note that the comparison is a comparison of addresses, not contents....

Read/writing/reversing integer arrays

The simple program Reads and traverse, write arrays and reverse the elements in an integer array. [sourcecode language=’cpp’] /******************************************************* * MYCPLUS Sample Code – https://www.mycplus.com * * * * This code...