Tag: Arrays

Difference between char[] and char* in C? Character Array and Pointer

Generally, the following two statements about char[] and char * in C are considered confusing and understanding the difference between them is important. 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.

Read More

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.

Read More

Java Dynamic Arrays – Integers

The DynamicArrayOfInt class is a simple implementation of a dynamic array in Java. A dynamic array is a resizable array that can grow or shrink in size as needed. This class provides methods to manipulate and interact with this dynamic array of integers. In the constructor, initially the data array has a size of 1 and grows as necessary.

Read More

Multiplication of Two Matrices in C

This C code multiplies two 2×2 matrices. It prompts the user to input values for both matrices, displays the input matrices, performs matrix multiplication using nested loops, and then prints the resulting matrix. The code adheres to modern C standards, using printf and scanf for I/O and avoiding outdated functions for better readability and compatibility.

Read More
  • 1
  • 2