04-19-2015, 02:24 PM
(04-19-2015, 12:05 PM)hhbuur link Wrote: i get the same outputs as before no mater witch of yours variations I try, can there may be a differences in the versions of gcc, makes the difference in the output, the version i haw install is 4:4.8.2-1ubuntu6 , and your ? I get the same result as in the book
I used 32-bit LL 2.2 and the gcc package is the same version# as yours.
I just downloaded the book so I could see exactly what the exercise was. Aside from making the correction from "DEFINE" to "define", it all looks the same as what I input and the output from mine matches that of the book (with no error messages). In all likelihood, if you're still getting error messages, you have a typo somewhere or a missed character. Double-check what you have.
From what you've posted, the only other thing I noticed is that you had a space between "sizeof" and "(int)" on this line:
Code:
printf("memory used:%d bytes\n",
((STRINGSIZE*3) * sizeof(char)) + sizeof (int) + (2 * sizeof(float)));
However, I purposely ran the code with that space also and it did not give me an error -- so I doubt that is the source of your problem.
Only other thing that I can think of is that you made the change from "DEFINE" to "define", saved the document, but did not re-compile the program with the new change. You need to save the change in the text file, then re-compile it before running the program again.
Aside from that, I'm clueless as to why it's not working for you.
Try Linux Beginner Search Engine for answers to Linux questions.