|
-
Jun 7th, 2004, 09:36 AM
#1
Thread Starter
Member
Dumb pointer question
Got a quick dumb question, What is the difference between the 2, which is a pointer?
example:
void convertToUpperCase( char * );
int main(){
convertToStringUpperCase(string);
return 0;}
void convertToUpperCase( char *sPtr ){
while ( *sPtr != '\0'){
if(islower(*sPtr))
*sPtr = toupper( * sPtr);
++sPtr;
}
}
this is an example of a pointer right, in the function convertToUpperCase, it takes
a single char parameter that points to sPtr
Now second example:
int* array = 0;
int* temp = 0;
int index;
array = new int[10];
temp = new int[20];
for( index = 0;index<10;index++)
temp[index] = array[index];
delete[] array;
array = temp;
temp = 0;
what the heck is this is this are lines 1 and 2 pointers?
I don't get this???????
I thought that to signify a pointer you place the * asterisk before the pointer name
thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|