Timeline for different between pointers and pointer to arrays?
Current License: CC BY-SA 3.0
9 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Feb 11, 2015 at 3:27 | vote | accept | Prateek Pande | ||
Feb 11, 2015 at 3:27 | vote | accept | Prateek Pande | ||
Feb 11, 2015 at 3:27 | |||||
Feb 10, 2015 at 18:23 | comment | added | kzidane |
@PrateekPande yeah, src is a variable of type char here. strcpy takes two arguments each of which is a char * . I passed &src to pass to address of src .
|
|
Feb 10, 2015 at 16:53 | comment | added | Prateek Pande | strcpy(dest, &src); usually we use strcpy(dest,src); | |
Feb 10, 2015 at 5:41 | comment | added | kzidane | @PrateekPande sorry I didn't see the first question. Where do you think there is an address of a char that is stored in a non-pointer variable exactly? | |
Feb 10, 2015 at 4:56 | comment | added | kzidane | @PrateekPande please see the Update section in the answer! | |
Feb 10, 2015 at 4:56 | history | edited | kzidane | CC BY-SA 3.0 |
added 1858 characters in body
|
Feb 10, 2015 at 4:42 | comment | added | Prateek Pande | 1. In the above example, while using strcpy , how can the address of a char be stored in a non pointer variable. 2. While using int array[Size]; we have to allot the size in advance. And while using int *array; we need not allocate the size..Is that true ? If we are not allocating memory to the *array; pointer variable, how can we say that it will allocate contiguous memory,as the next memory address might be already occupied, as we have not reserved for the array. | |
Feb 9, 2015 at 12:06 | history | answered | kzidane | CC BY-SA 3.0 |