User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the C++ section within the Software Development category of DaniWeb, a massive community of 456,470 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,802 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C++ advertiser: Programming Forums

Pointers (archived tutorial)

Join Date: Apr 2008
Posts: 1
Reputation: PeterPimmel is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
PeterPimmel PeterPimmel is offline Offline
Newbie Poster

Re: Pointers

  #12  
Apr 26th, 2008
Originally Posted by Ancient Dragon View Post
		ptr[i] = malloc(strlen(word[i]) + 1 * sizeof(char **)));

Overall, give you B+ for good tutorial. Correct the mistakes and it can be a great tutorial.

nah, this was wrong anyway.

SO BE CAREFUL FOLKS! it has to be:
		ptr[i] = malloc((strlen(word[i])+1) * sizeof(char **)));
instead of
		ptr[i] = malloc(strlen(word[i]) + 1 * sizeof(char **)));
you know * binds stronger than + ... good old math :-P

damn someone should change this in the tutorial... I took me some nerves to find out why my app was crashing :-P
Reply With Quote  
All times are GMT -4. The time now is 2:28 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC