answersLogoWhite

Top Answer
User Avatar
Wiki User
Answered 2012-09-06 06:02:29

char c[3]; //array of 3 chars

char * p; //pointer of type char

p=c; //point the pointer to the base of char array

001
๐Ÿ™
0
๐Ÿคจ
0
๐Ÿ˜ฎ
0
๐Ÿ˜‚
0
User Avatar

Your Answer

Related Questions


Please ask just one question at a time!Question 1:How do you declare an array of three pointers to chars?How do you declare an array of three char pointers?Note: both of these questions are merely alternative wordings for the same question.Answer 1:char * a[3];Question 2:How do you declare a pointer to an array of three chars?Answer 2:char a[3]; // an array of three charschar * p = a; // a pointer to an array of three charsQuestion 3:How do you declare a pointer to a function which receives an int pointer?Answer 3:#include // some functions we can point at:void func_1(int * p){}void func_2(int * p){}// note: all functions we wish to point at with the same// pointer must have the same signature.int main(){int* p = NULL; // instantiate an int pointervoid (*pFunc) (int*); // declare a function pointerpFunc = func_1; // point to func_1pFunc(p); // call func_1 via function pointerpFunc = func_2; // point to func_2pFunc(p); // call func_2 via function pointerreturn(0);}Note that the brackets in the function pointer declaration are required. If you omit them, you will end up with a standard function declaration that returns a pointer to void, resulting in a compiler error.


char* my_array[3]; /* an array of three pointers to char */


char* a[3]; char* b[3]; char[3] *c; void(*d)(int*); Note that these are definitions. To make these declarations only, use the keyword 'extern'.


You point at the array the same way you would with an array of any pointer type, by using an additional level of indirection than is employed by the pointers in the array itself. In this case, the array contains pointer-to-function data types (with one level of indirection), thus you must use a pointer-to-pointer-to-function data type (with two levels of indirection) in order to point at the array itself. Had the array contained pointer-to-pointer-to-function data types (where each pointer points to a separate array of pointer-to-function data types), then you'd use three levels of indirection, and so on. You increase the level of indirection by placing an additional asterisk before the pointer's name when you declare the pointer. That is, one asterisk per level.



int main() { char *array[3]; // This declares an array of type char*of size 3 // Declare two random chars char example0 = 'X'; char example1 = 'Y'; // You can use the char* array elements just like any regular char* array[0] = example0; array[1] = example1; printf("array[0] = %c, array[1] = %c\n", array[0], array[1]); // Prints X, Y array[0] = example1; array[1] = example0; printf("array[0] = %c, array[1] = %c\n", array[0], array[1]); // Prints Y, X return 0; }



Yes. More specifically, they can be used to represent a dynamic multi-dimensional array. As most people know, for a one-dimensional dynamic array, you simply need a pointer to the first element in the array, where each element contains an object of the same type as the pointer. The pointer can be passed around functions just as if it were a static array, the only difference being the requirement to pass the upper bound of the array as well as the array itself. For a two-dimensional array, you need a pointer-to-pointer which points to the first element of a one-dimensional pointer array, where each pointer in that array points to a one-dimensional array of objects. The pointer-to-pointer must be the same type as the pointers and the objects. For a three-dimensional array you need a pointer-to-pointer-to-pointer. And so on. Each additional dimension simply adds a new level of indirection, and a new level of one-dimensional pointer arrays. Of course multi-dimensional arrays are only useful if every dimension is fully utilised and doesn't require too much in the way of resizing. If that is not the case, then you may get more efficient memory consumption from a vector of vectors (of vectors), which allows dynamic resizing at every level without having to copy existing elements. The downside is you lose the random access provided by the array.


If you imagine a standard chessboard, a one-dimensional array representing each of the squares on the board would need to contain 64 elements (numbered 0 to 63). However, because the board itself is two dimensional, it makes more sense to refer to individual squares by the intersection of the square's row and column. Thus a two dimensional array will contain 8 rows and 8 columns (each of which is numbered 0 to 7). Another way to look at a two-dimensional array is to imagine that first dimension represents a one-dimensional array of rows while each of these row elements is itself a one-dimensional array of squares, with one square per column. This may seem counter-intuitive at first, but when dealing with dynamic arrays, that may be exactly how the array is allocated. That is, while a static array always occupies contiguous memory locations (regardless of how many dimensions), a dynamic array is often allocated one dimension at a time. Each one-dimensional array will itself be contiguous, but the array as a whole may not be. However, regardless of how the memory is mapped, the dimensions make it easier to determine which individual element you are accessing. If our board were declared as a one-dimensional array, accessing element[24] doesn't immediately tell us which row or column that element resides in. Whereas element[4][0] tells us exactly which row and column the square is in. These are, in fact, the same square (and therefore the same element), but the second is more intuitive as there's a direct correlation between the array and the object it represents (an 8x8 chessboard). Arrays aren't restricted to just one or two dimensions. A three-dimensional array might be used to represent a cuboid. For instance, a standard 3x3x3 Rubik's cube might be represented by a three-dimensional array where each dimension has three elements (if we conveniently ignore the fact a Rubik's cube is not a real cube with 27 individual cubes). We can also go beyond 3-dimensions without the need for a Degree in Theoretical Physics. The trick is to remember that each dimension is itself a one-dimensional array. Therefore a four-dimensional array can be thought of as a one-dimensional array where each element is a three-dimensional array. A five-dimensional array is therefore a one-dimensional array where each element contains a four-dimensional array, and so on. Once you're familiar with this way of thinking, it no longer matters if the array is allocated contiguously or separately. Every element is addressable by its unique index, whether that index contains one or multiple dimensions. Dynamic arrays are a bit more difficult to work with, particularly when there are multiple dimensions to consider. However, the simplest way to manage them is by allocating a one-dimensional array for the entire array (multiplying all the dimensions together), and then use a separate array of pointers to divide the larger array into its individual dimensions, and finally maintain a pointer-to-pointer variable to refer to the array of pointers. So, going back to our chessboard example, if we suppose the chessboard is not restricted to 8x8 squares, a static array would be no use as it couldn't cater fora 9x9 board. Se we need a dynamic array. We begin by declaring a pointer-to-pointer and allocate a 9-element array of pointers to it. We then allocate an 81-element array to the first pointer. The other 8 pointers are then assigned an address within the 81-element array, such that each is offset by 9 elements from the previous element. Now we can access the array itself using the pointer-to-pointer, just as if it were a static array. If the pointer-to-pointer were named board, then board[1][2] would access the square in the second row, third column. This works because the [1] refers to the second pointer in the pointer array (which points to the second row in the array), while the [2] refers to the third element in that row. The language is such that we need not concern ourselves with the fact an array of pointers exists but, without it, we'd not be able to access the array multi-dimensionally. An alternative way to allocate the array would be to allocate individual one-dimensional arrays to each pointer in the pointer array (where each array represents a row on the board). However, because this would require 9 separate allocations, the creation of the array as a whole takes much longer than it would with the single allocation. In addition, releasing the array is much simplified as we only have to release the entire array (pointed to by the first element in the pointer array), and then release the pointer array itself. Using individual allocations would mean releasing each pointer in the pointer array before release the pointer array itself. Regardless of how the array is allocated, accessing the individual elements is achieved in the same way, via the pointer-to-pointer. It does not matter if the array resides in contiguous memory or not -- the pointer array takes care of all that for us automatically. Moving onto three dimensions and beyond is only complicated by the fact the pointer-to-pointer requires an extra level of indirection for each additional dimension. That is, a pointer-to-pointer-to-pointer is required for a three-dimensional array, which points to an array of pointer-to-pointer, each of which points to an array of pointer, each of which points to an appropriate offset within the actual array. Why bother with just two? Think about 27+(just to begin with) different dimensions & inter Universal expansionsional change regarding 'PURE ENERGY the form of Dark Matter & it's direct correlation with it's inter-actional Relationship to CREATION & ALL Eternity should be able to do that over lunch:)) 'Doc' is just fine:) Pick your Wavelength & the several Frequencies contained therein..........& GO FOR IT. You have talent.


An array never behaves like a pointer.Understand that a pointer is a variable -- no different to any other variable, other than its type. like any other variable, it is allocated its own memory (4 bytes in a 32-bit system). Those 4 bytes can store any 32-bit value, from 0x00000000 to 0xFFFFFFFF, but because it is declared to be a pointer, that value actually represents a memory location, somewhere within the 4GB address space. 0x00000000 is a reserved memory location -- what we refer to as NULL.An array is not the same as a pointer in any sense. The array name refers to the actual memory (the starting address) where the array resides. But the array name is not a variable -- unlike a pointer, it is not separate from the memory it refers to -- it is merely an alias that refers to the memory allocated to the array itself.That said, pointers and arrays can appear to be the same. For instance, the strlen() function expects you to pass a const char pointer, and yet you can pass an array name instead and it works just fine:char cArray[12];char * p = cArray;strlen( p ); // Pass a pointerstrlen( &cArray[0] ); // Pass pointer to array element via AddressOf operatorstrlen( cArray ); // Pass an array nameAll three of these functions work exactly the same so it would be easy to assume the array is a type of pointer. But it is not. To understand what's really going on here you have to understand how pointers and arrays are actually passed to function.When you pass a pointer to a function, you don't pass the pointer itself, you pass the memory address stored in the memory allocated to the pointer. In other words, pointers are passed by value, not by reference. Similarly, when you pass an array name, you pass the starting address of the array.That's all there is to it! The function's parameter, a pointer, is allocated its own memory. It is a temporary variable, local to the function. All it expects is a memory location so whether you pass a pointer or an array name, that's exactly what it receives.


All arrays are linear data structures, as are all lists. Arrays are linear because multiple elements are allocated in contiguous memory. If the array is a pointer array, only the pointer array need be contiguous; the data being pointed at can reside anywhere in memory, whether contiguous or not (you might use a separate pointer array to indirectly alter the order of elements in another array). Large and dynamic multi-dimensional arrays are typically allocated as a large array of pointers each of which points to a small array of data elements. For instance, a four-dimensional array might be allocated as a contiguous three-dimensional array of pointers, each of which points to a separately allocated one-dimensional array of data elements. Although this uses more memory overall to cater for all the pointer variables, allocating separate memory to each one-dimensional array is more likely to succeed than if all the elements were allocated as a contiguous multi-dimensional array, especially if the individual data elements are quite large.


A one dimensional array is a scalar value repeated one or more times.A two dimensional array is an array of one dimensional arrays.A three dimensional array is an array of two dimensional arrays, and so forth.The one dimensional array is like a list of things, where the two dimensional array is like an array of things. (Think one row of a spreadsheet versus the whole spreadsheet.)[addendum]Every level of array depth is also a level of pointer depth. For example: A 3 dimensional int array is an int***. So a one dimensional int array is an int*, and a two dimensional int array is an int**. This is only important if you are doing pointer work, but it can become very important.


An array is a contiguous block of memory containing one or more elements of the same type. The array identifier is a reference to that block of memory. References do not require any memory other than the memory they reference. References are not variables -- they are merely aliases for memory addresses. A pointer is a variable that can store any reference and provides indirect access to that reference. Pointers can be used to allocate arrays dynamically, which means memory is required not only for the array, but also for the pointer to store the starting memory address of the array. Once allocated, the array can be referenced directly, but the pointer is still required in order to release the memory allocation when it is no longer required. Arrays employ pointer arithmetic to locate individual elements by their zero-based index, which is essentially an offset from the reference multiplied by the size of the element type. However arrays and pointers are not the same from a programming standpoint. Your compiler may well implement references as pointers, but that is only of concern to compiler authors, not programmers. Two-dimensional dynamic arrays make use of a pointer-to-pointer variable to point to a one-dimensional array of pointers, each of which points to a one-dimensional array of the actual elements. A three-dimensional array employs a pointer-to-pointer-to-pointer to point to a one-dimensional array of pointer-to-pointer variables, each of which points to a two-dimensional array. And so on. Static arrays use less memory as there is no need to maintain arrays of pointers, but static arrays are only useful when the number of elements and dimensions are known at compile time. At runtime, arrays of pointers are required over and above the array elements themselves, in order to both allocate and deallocate the memory, as well as obtain references to the elements in the array. Pointers also have uses beyond that of dynamic arrays, including allocating any type of memory of any size, and pointing at functions which can then be passed as arguments to other functions.


If you are standing behind the three point line, the arc going around the hoop, it is a three-pointer. Any other shot is a two-pointer.


When you shoot from the three pointer line which is behind the foul line.


Click on the 'History of the Three Pointer' link on this page to learn about the history of the three point shot.


he shoots a basket from three yards away making it a three pointer


An array in java is a collection of items stored into a single unit. The array has some number of slots (elements), each slot in the array can hold an object or a primitive value. Arrays in java are objects that can be treated just like other objects in the languageArrays can contain any type of element value , but we can't store different types in a single array. We can have an array of integers or an array of strings or an array of arrays.To create an array in java ,use three steps1. Declare a variable to hold the array2. Create a new array object and assign it to the array variable3. Store things in that array


Ronnie Carr sank the first three pointer in 1980.


In C, all arrays implicitly convert to a pointer at the slightest provocation. As such, it is not possible to pass arrays by value (arrays cannot be copy-constructed), they must be passed by reference. Thus to accept an array, the function argument must be a pointer of the appropriate type. In cases where the size of the array cannot be deduced from the pointer alone, you must also pass the size of the array. Exceptions include null-terminated arrays, such as a null-terminated character array (a string), because the null-terminator marks the end of the array thus the size (if required) can be deduced. In C++, we can pass arrays as objects, both by value and by reference. The standard template library provides three templates for arrays: std::array for fixed-length arrays; std::vector for variable-length arrays; and std::valarray for one-dimensional numeric matrices. We can also use C-style arrays as per C.


The three pointer entered high school as soon as the NBA created the three point shot.


Chris Ford of the Boston Celtics hit the first three pointer in 1986 Western Carolina


The first man to score a three pointer was RONALD-BYERS he was an true basket baller. It was made in 1945


Free throw, 2 pointer, 3 pointer.


In general, a multidimensional array is an array that requires more than one index to save or restore elements. An array can have one, two, three, four, etc. dimensions. For example, a four-dimensional array would require four index values to access any of its elements. Specifically in Java, a two-dimensional array is implemented as an array of arrays, a three-dimensional array as an array of arrays of arrays, etc.



Copyright ยฉ 2021 Multiply Media, LLC. All Rights Reserved. The material on this site can not be reproduced, distributed, transmitted, cached or otherwise used, except with prior written permission of Multiply.