Search Results

Showing results 1 to 10 of 10
Search took 0.01 seconds.
Search: Posts Made By: laconstantine ; Forum: C and child forums
Forum: C May 12th, 2007
Replies: 27
Views: 3,866
Posted By laconstantine
"That Works" means yes?
Forum: C May 11th, 2007
Replies: 27
Views: 3,866
Posted By laconstantine
The array name is used to represent the whole array (memory block) in 3 situations:
as narue said
1) As the operand to sizeof
2) As the operand to the address-of operator
3) As a string constant...
Forum: C May 11th, 2007
Replies: 27
Views: 3,866
Posted By laconstantine
cout << &arr << endl << &arr[0];

why they both have the same address??

arr is the array not the first element?
Forum: C May 10th, 2007
Replies: 27
Views: 3,866
Posted By laconstantine
Okay i think i got it now.

int arr[2] = {2,3};
we are using a memory block to the first element we are giving the value 2 and the second 3.

The array name is used to represent the whole array...
Forum: C May 10th, 2007
Replies: 27
Views: 3,866
Posted By laconstantine
so when we declare an array:

int arr[2] = {2,3};

we are taking some bytes "as a memory block"

then creating a pointer called 'arr' and pointing him to the block.

then when we using it in...
Forum: C May 10th, 2007
Replies: 27
Views: 3,866
Posted By laconstantine
Too much complicated!!

int arr[2] = {2,3};
cout << sizeof(arr);

the output is 8, so how the hell arr can be a pointer to the first element (4bytes) if its 8 bytes size!!!

I dont understand...
Forum: C May 10th, 2007
Replies: 27
Views: 3,866
Posted By laconstantine
So the first element and the array its self are at same memory location,and the compiler treats the array as a pointer and as the TYPE its declared?
Forum: C May 10th, 2007
Replies: 27
Views: 3,866
Posted By laconstantine
I cant understand this

/* Address of the first element */
printf ( "%p\n", (void*)&arr[0] );

/* Address of the array converted to a pointer */
printf ( "%p\n", (void*)arr );

/* Address of...
Forum: C May 9th, 2007
Replies: 27
Views: 3,866
Posted By laconstantine
So when we declare an array here:

int arr[2] = {2,3};

we are taking 8 bytes of memory , then we are giving to 4 bytes of it the value 2 and the next 4 bytes of it the value 3.
then "arr" is...
Forum: C May 9th, 2007
Replies: 27
Views: 3,866
Posted By laconstantine
I just was wondering why the array its self are a pointer to the first element?
and what is the difference between an array and a pointer?
Showing results 1 to 10 of 10

 


About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC