c faqs

C faqs

Question1: Difference between arrays and pointers?
 Answer: Pointers are used to manipulate data using the address. Pointers use * operator to access the data pointed to by them
 Arrays use subscripted variables to access and manipulate data. Array variables can be equivalently written using pointer expression.

Question2: What is the purpose of realloc ( )?
 Answer: The function realloc (ptr,n) uses two arguments. The first argument ptr is a pointer to a block of memory for which the size is to be altered. The second argument n specifies the
new size. The size may be increased or decreased. If n is greater than the old size and if sufficient space is not available subsequent to the old region, the function realloc ( )
may create a new region and all the old data are moved to the new region.

Question3: What is static memory allocation and dynamic memory allocation?
Answer: Static memory allocation: The compiler allocates the required memory space for a declared variable. By using the address of operator, the reserved address is obtained and this address may be assigned to a pointer variable. Since most of the declared variable has static memory, this way of assigning pointer value to a pointer variable is known as static memory allocation. Memory is assigned during compilation time.

Dynamic memory allocation: It uses functions such as malloc ( ) or calloc ( ) to get memory dynamically. If these functions are used to get memory dynamically and the values returned by these functions are assigned to pointer variables, such assignments are known as dynamic memory allocation. Memory is assigned during run time.

Question4: How are pointer variables initialized?
Answer: Pointer variable are initialized by one of the following two ways
              Ø Static memory allocation
              Ø Dynamic memory allocation

Question5: What is a pointer variable?
Answer: A pointer variable is a variable that may contain the address of another variable or any valid address in the memory.

Question6: What is a pointer value and address?
Answer: A pointer value is a data object that refers to a memory location. Each memory location is numbered in the memory. The number attached to a memory location is called the address of the location.
Keywords:
difference between arrays and pointers
purpose of realloc in c
static memory allocation and dynamic memory allocation in c
pointer variable initialization in c
pointer variable in c
what is a pointer value and address in c
difference between array and pointer in c in tabular form
differentiate between array of pointers and pointers to array
relation between array and pointer in c
difference between array and pointer in c in hindi
array of pointers in c
difference between array and pointer in hindi
which of arrays or pointers are faster
difference between array and structure
static memory allocation in c geeksforgeeks
difference between static and dynamic memory allocation? - quora
advantages and disadvantages of static and dynamic memory allocation
dynamic memory allocation in c++
static memory allocation in c++ with example program
when is memory allocated and deallocated in c? answer both static and dynamic memory.
static and dynamic memory in computer organization
dynamic memory allocation in c pdf
declaration and initialization in c
how to initialize a pointer c++
accessing a variable through its pointer
pointer arithmetic in c
pointer to pointer in c
pointer and array in c
pointer operator in c
pointer assignment in c
pointer in c example
pointers in c pdf
use of pointers in c
double pointers in c
types of pointers in c
pointers in c geeks for geeks
list of c programs on pointers
pointers and arrays in c
use of pointers in c
pointers in c geeks for geeks
list of c programs on pointers
what is pointer in c++
pointers in c pdf
pointer in c example
types of pointers in c
double pointers in c

No comments: