Its using argument count and a argument vector array in the main function to take in command line arguments after the program name, right?. Even if I rename the array, int, and definitions, is it ok to use the code in the walkthrough and use it in my pset code? I read the academic honesty in the pset and I'm still not entirely sure what's the line to draw when it comes to using your own work and seeing someone else's and using there snippets of code into yours.


If you are talking about using this, int main(argc, argv[])then yes, this is perfectly acceptable, and expected. In c programs, you must have a main function to run a program. More important to your question, (argc, argv[]) is the defined mechanism for passing parameters from the command line or program call into your program.

Also, don't rename argc and argv[], they are predefined in c for that purpose. (I'm not even sure it would work if you did, but it would be a good experiment. Why don't you try and let us know what happens with a comment! )

So, don't worry, you're expected to use it, just like everyone else. ;-)

On the subject of using other's code, that's not as straightforward. For assignments, using someone else's code that is specifically about an assignment is almost certainly a no. However, using code that you may have found for a certain part of your program may well be proper, as long as you credit the source.

As an example, suppose that as a part of your assignment (which isn't about sorting) that you need a sort function. You find a very efficient sort on the internet. As long as you credit the source in comments within your program, it should be acceptable to use that sort. On the other hand, if your assignment is to encrypt something, using the code that someone else wrote to do the same assignment is a definite no. However, if the assignment is to do a sort or a hash, then it can be a really fine line. Are you lifting someone else's code to accomplish something that the assignment wants you to do yourself? Or does using the sort that you found just help to accomplish a larger goal? As a guideline, if it feels like you shouldn't be using other code, you probably shouldn't.

Something else to know, if something is demonstrated in a lecture or any of the formal class materials, it is fair to use it yourself. (This does not include using the staff solutions that may be provided for a particular assignment.) Also, in my opinion, getting ideas from other code, to help you figure out how to do something is certainly acceptable. That's how we learn new techniques.

If you are still in doubt about any academic honesty questions, you should contact actual staff with specific questions.

Disclaimer: I am not staff, but I have been a professional programmer for many years. These are my opinions. While questions that ask for opinions are not generally appropriate for this forum, the specifics of this question make it perfectly acceptable. Academic honesty in use of code is an important issue to this group. Also, the use of main(argc, argv[]) is more of a factual matter.

If this answers your question, please mark this question as answered. Let's keep up on forum maintenance. ;-)

| improve this answer | |

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .