Declaring a variable sets it up to be used at a later point in the code. You can create variables to hold numbers, characters, strings (an array of characters), etc.
You can declare a variable without giving it a value. But, until a variable has a value, it's not very useful.
You declare a variable like so: NOTE: This variable is not initialized.
Once a variable is declared, you can assign a value to it, like: NOTE: Assigning a value to initializes the variable.
To make things easier, if you know what a variable should be when you declare it, you can simply declare it and assign it a value in one statement: NOTE: This declares and initializes the variable.
So, once your myChar variable has been given a value, you can then use it in your code elsewhere. Example:
This prints the value of myChar and myOtherChar to stdout (the console), and looks like:
If you had declared without assigning it a value, and then attempted to print to stdout, you would receive an error telling you that myChar has not been initialized.
Suggested Good Practice for Student Declaration
This good practice guideline was prepared by the plagiarism working group in 2007, and approved by UTLC in May 2007. It will be subject to periodic review.
UTLC recommends that all Schools seek to use two forms of student declaration:
- an initial and detailed declaration
- a declaration for the submission of each piece of assessed work
Template wording for these declarations are provided below.
Suggested Student Declarations relating to plagiarism
The initial/detailed declaration. It is suggested that this should be used following degree programme briefings on good academic conduct and avoiding plagiarism (within a few weeks of the start of term and before the first assignment is due). Note that if students do not attend such a session, there should be follow-up to ensure that they have the necessary briefing materials and also sign this declaration. The suggested template is as follows.
I acknowledge that the University provides advice to students on good academic conduct (and how to avoid plagiarism and other assessment irregularities) – and that this is available to all students on the Internet at www.ncl.ac.uk/right-cite
I acknowledge that my School provides additional advice and materials on good academic conduct (and how to avoid plagiarism and other assessment irregularities) – and that this is available to all students on the Internet at www.ncl.ac.uk/right-cite
I acknowledge that I have also been advised by academic staff about standards for good academic conduct and how to avoid plagiarism and other assessment irregularities.
I acknowledge that plagiarism is the unacknowledged use of another person's ideas, words or work either verbatim or in substance without specific and appropriate acknowledgement.
I acknowledge that the inclusion of a footnote or a source in a bibliography is insufficient for attribution of another's work.
I acknowledge that any work that I submit for assessment at Newcastle University:
I acknowledge that I must take reasonable steps to ensure that my assessments – and related preparatory work for submissions – are kept secure so that I do not enable another person to copy my work, other than what is acceptable for the specific assessment guidelines for the piece of work (group work).
I accept that the School may check the originality of my work using a range of techniques, including computer based plagiarism detection software.
I accept that any suspected irregularity in my work will be dealt with under the University’s Assessment Irregularities Procedure (available at
The brief declaration for each piece of assessed work is suggested as follows.
I declare that this assignment is my own work and that I have correctly acknowledged the work of others. This assignment is in accordance with University and School guidance on good academic conduct (and how to avoid plagiarism and other assessment irregularities). University guidance is available at www.ncl.ac.uk/right-cite