firefly2442 Posted November 21, 2004 Share Posted November 21, 2004 In C++... what is the difference between a ".h" header file and a ".c" source file? Thanks. Does anyone here do any C++ programming? Quote Link to comment Share on other sites More sharing options...
Specter Posted November 21, 2004 Share Posted November 21, 2004 The header file contains precompiled information from code libraries and such. The source file is what you create after it's compiled into a program. The source file is all the code you wrote to create a program. Quote Link to comment Share on other sites More sharing options...
Specter Posted November 21, 2004 Share Posted November 21, 2004 Here is a good definition of source code. This site is great when you need help with terms and what computer stuff does. Quote Link to comment Share on other sites More sharing options...
Sup Posted November 21, 2004 Share Posted November 21, 2004 I've got a n00b C++ question too.... Where can I find a book that actually helps? Quote Link to comment Share on other sites More sharing options...
harntrox Posted November 21, 2004 Share Posted November 21, 2004 learn some BASIC learn some C then you'll have a much better chance of getting C++ gotta learn to walk before you run Quote Link to comment Share on other sites More sharing options...
Super-Bob Posted November 21, 2004 Share Posted November 21, 2004 A header will have only function and object definitions, as in the headers (that's why its a header file). The header file will then include its source which has all the actual functions and constructors and such. Quote Link to comment Share on other sites More sharing options...
Super-Bob Posted November 21, 2004 Share Posted November 21, 2004 learn some BASIC learn some C then you'll have a much better chance of getting C++ gotta learn to walk before you run ← Not really so true. I learned VB then C++. Your way is kinda like walking, running with one foot, then running with 2. Quote Link to comment Share on other sites More sharing options...
firefly2442 Posted November 21, 2004 Author Share Posted November 21, 2004 Java is similar to C++ as I've heard and I pretty much know Java now (from college courses). So I hope I'll be ok. Thanks for the help. Quote Link to comment Share on other sites More sharing options...
firefly2442 Posted November 21, 2004 Author Share Posted November 21, 2004 So lemme try this out, in Java, the whole "an object is an instance of a class" thing. This is kinda similar except from the code you are including these headers which have all this information and code to setup variables and so on in them? Does that make sense? Quote Link to comment Share on other sites More sharing options...
Sup Posted November 21, 2004 Share Posted November 21, 2004 I'd heard I should learn Java before... I'll see if I can try that. Quote Link to comment Share on other sites More sharing options...
DonMiguel Posted November 21, 2004 Share Posted November 21, 2004 learn some BASIC learn some C if you're learning, start with anything that is OOP based. learning logic and program flow can be done in any language. Starting with OOP instead of migrating to it will make your future programming experiences conceptually easier. That said, C is still used by professionals, esp in game coding, so being familiar with C wouldn't hurt at all. Quote Link to comment Share on other sites More sharing options...
Matt03 Posted November 22, 2004 Share Posted November 22, 2004 It seems like the colleges are starting out with Java. Is this the case that most of you who have started out recently seen? I assume this is because it is Object Oriented. http://www.cs.nps.navy.mil/people/faculty/...97/java_ans.htm Article my Java teahcer gave the class. Something to think about when you are paying all that money for your Java class. Quote Link to comment Share on other sites More sharing options...
Sup Posted November 22, 2004 Share Posted November 22, 2004 The yellow burns my eyes... Quote Link to comment Share on other sites More sharing options...
Matt03 Posted November 22, 2004 Share Posted November 22, 2004 (edited) The yellow burns my eyes... ← Copy and paste it somewhere then. Edited November 22, 2004 by Matt03 Quote Link to comment Share on other sites More sharing options...
firefly2442 Posted November 23, 2004 Author Share Posted November 23, 2004 Quote from article: In horrible C tradition, Java arrays start from zero, instead of one. How many future programmers will spend hours locating off-by-one errors? What is wrong with the number one? This is SO true. I've been studying graph algorithms, search algorithms, sort algorithms, I'm up to my eyeballs in algorithms and let me tell you, if I had a dollar for every time I was off on my index by one...... grrrrrr Quote Link to comment Share on other sites More sharing options...
Super-Bob Posted November 23, 2004 Share Posted November 23, 2004 0 is a number too. Quote Link to comment Share on other sites More sharing options...
Matt03 Posted November 23, 2004 Share Posted November 23, 2004 It is a number but it is a lot easier to understand when you start at one. It is just easier for people to think starting at one than zero. Think about it. When you start counting you don't start at zero do you? Quote Link to comment Share on other sites More sharing options...
Specter Posted November 24, 2004 Share Posted November 24, 2004 It is a number but it is a lot easier to understand when you start at one. It is just easier for people to think starting at one than zero. Think about it. When you start counting you don't start at zero do you? ← Not out loud, no. But you can and some do when counting money, and everything related to a PC can or does start with a zero; zero actually counting as a number. Zero doesn't mean 'nothing' in the computer world. Quote Link to comment Share on other sites More sharing options...
Matt03 Posted November 24, 2004 Share Posted November 24, 2004 But aren't we talking about a computer language used by people? Quote Link to comment Share on other sites More sharing options...
Dannik Posted November 24, 2004 Share Posted November 24, 2004 But aren't we talking about a computer language used by people? ← We're talking about a computer language used by computers, but is entered by people. Subtle difference. Zero is a logical character, and computers are logical by design, thus programmers have to work with the inherent logic of the hardware/software when writing code. To put it this way: In English, other than pronouns, gender has no role. In French, nouns are masculine or feminine. In German, it's like French, but there are Neutral gender words. The speaker must adapt their format to suit the platform/language/nation/whatever they are communicating with. Quote Link to comment Share on other sites More sharing options...
Matt03 Posted November 24, 2004 Share Posted November 24, 2004 But shouldn't writing a program be easier for the programmer? The computer doesn't care if the array starts with 0 or 1. So why not start with the one that is esaier for people to understand. Quote Link to comment Share on other sites More sharing options...
supasniper Posted November 24, 2004 Share Posted November 24, 2004 why is it harder to start with 0? anyone who uses computers a lot and knows a fair bit about what's behind them e.g binary, hex etc starting with a 0 is normal Quote Link to comment Share on other sites More sharing options...
DonMiguel Posted November 25, 2004 Share Posted November 25, 2004 (edited) I'd like 2 as the start, but it all comes down to binary, so you 0 and 1 freaks get it all. Edited November 25, 2004 by DonMiguel Quote Link to comment Share on other sites More sharing options...
Matt03 Posted November 25, 2004 Share Posted November 25, 2004 (edited) Maybe the only problem that I have is the variable lenght that is created when the array is created. It is set to the value that you say i.e. (int[] i = new int[25]) lenght will be 25 while the array only goes from 0-24. Edited November 25, 2004 by Matt03 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.