Mix Imp Questions C&C++
Mix Imp Questions C&C++
4. What is a pointer?
Pointers are variables which stores the address of another variable. That variable may be a scalar
(including another pointer), or an aggregate (array or structure). The pointed-to object may be part of
a larger object, such as a field of a structure or an element in an array.
Pointers
Pointers are used to manipulate data using the address. Pointers use operator toaccess the data
pointed to by them.
Arrays
Arrays is a collection of similar datatype. Array use sub-scripted variables to access and manipulate
data. Array variables can be Equivalently written using pointer.
28. What is the difference between a string copy (strcpy) and a memory copy
(memcpy)?
The strcpy() function is designed to work exclusively with strings. It copies each byte of the source
string to the destination string and stops when the terminating null character () has been moved. On
the other hand, the memcpy() function is designed to work with any type of data. Because not all data
ends with a null character, you must provide the memcpy() function with the number of bytes you
want to copy from the source to the destination.
29. What is the difference between a NULL Pointer and a NULL Macro?
Null pointer is a pointer that is pointing nothing while NULL macro will used for replacing 0 in program
as #define NULL 0 .