Re: [Dev-C++] One other minor problem
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Khalid El-K. <kha...@ho...> - 2003-04-13 03:24:23
|
look below :) >>I also have one other minor problem. >> >>Though I have looked through over 16 different manuals and tutorials, and >>have searched over 50 websites I cannot seem to find out the difference >>between >> >>char* foo; >>char *foo; >>char* *foo; >> >>From my own expirements (purposely generating compiler errors) it >appears >>to me that the first two are identical. They both seem to >declare foo to >>be a variable of type char*. The second seems to >declare foo a pointer >>to type char*. It also appears to me that type >char* is actually a >>char[] of dynamic length because I can get string >functions to work on it >>- just like on char[]. >> >>I have found no confirmation of any of this though. I would appreciate >> >any info anyone has about this. > >Your thoughts are right, but the thing that produces compilation error, >maybe the malloc/realloc/calloc thing associated with them: > >//for char**: >char **str_arr; >int num_of_elements = 5; >str_arr = (char**) malloc(num_of_elements*sizeof(char*)); > >//the for each element of that array you should malloc >str_arr[0] = (char*) malloc(10*sizeof(char); //sorry meant: str_arr[0] = (char*) malloc(10*sizeof(char)); //note the last bracket *shy* > >... > >Hope that helps. > >>Shane Plesner > >Regards, >Khalid Al-Kary > > >_________________________________________________________________ >Add photos to your messages with MSN 8. Get 2 months FREE*. >http://join.msn.com/?page=features/featuredemail > > > >------------------------------------------------------- >This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger >for complex code. Debugging C/C++ programs can leave you feeling lost and >disoriented. TotalView can help you find your way. Available on major UNIX >and Linux platforms. Try it free. www.etnus.com >_______________________________________________ >Dev-cpp-users mailing list >Dev...@li... >TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm >https://lists.sourceforge.net/lists/listinfo/dev-cpp-users _________________________________________________________________ STOP MORE SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail |