Introduction to Sorting Algorithm..................................................................................................59
Grade D......................................................................................................................................60
Grade C.......................................................................................................................................61
Grade B.......................................................................................................................................62
Grade A.......................................................................................................................................63
Assessment 7......................................................................................................................................64
Introduction of Function.................................................................................................................64
Recursion....................................................................................................................................65
Grade D......................................................................................................................................66
Grade C.......................................................................................................................................69
Grade B.......................................................................................................................................72
Scope of Variable........................................................................................................................75
Class of Variable.........................................................................................................................75
Grade A.......................................................................................................................................76
Reflecting Report................................................................................................................................80
References..........................................................................................................................................82
Bibliography.......................................................................................................................................83
Appendices.........................................................................................................................................84
Introduction
What is Programming and C language?
3
, SOLENT UNIVERSITY
Programming is a serial of instruction that it is given to the computer. Those must be converted to one of the
languages used in the computer. This process is called compilation and it is using a software application
called compiler. C language is a binary language that the computer understands and one of the most used
programming languages. C was created by Dennis Ritchie at the Bell Laboratories in 1972. C is strongly
associated with UNIX, as it was developed to write the UNIX operating system. For this portfolio will be use
Replit.com but there are other program, like Visual Studio Code. The C program instruction start with the
main function, showed below.
#include <stdio.h>
int main(void)
{printf("Hello World\n");
return 0;}
The library stdio.h is the most used in C programming that contains input and output types, functions that the
program will use, this included almost the 75% of the C library, for example if the program needs
mathematic functions it needs to be included, in addition, #include<math.h>. The int main means that this is
our main function and (void) that doesn’t return to any other function. For include something that needs to be
show in our program we need to start with curly bracket and end with it. Printf followed with open and close
bracket and quotation marks open and close as well, it will print on our console what is inside, in this case
Hello World. \n is an escape sequence that we will talk about on the first assessment and on the end our
return 0; that tell the system that the program it might be terminated (in this assignment return 0; is not using
as not necessary to keep in the program). (Gookin, 2004)
In this Portfolio, it has been divided into functions, as showed below:
#include <stdio.h>
void gradeA();
void gradeB();
void gradeC();
void gradeD();
int main(void) {
int grade;
printf("Select the Grade.\n1-GradeD\n2-GradeC\n3-GradeB\n4-GradeA\
n");
scanf("%d", &grade);
if (grade == 1) {
gradeD();
} else if (grade == 2) {
gradeC();
} else if (grade == 3) {
gradeB();
} else if (grade == 4) {
gradeA();
} else {
printf("Wrong digit! Try again between 1 and 4.");}
}
N.B.: Functions will be explained in Assessment 7 of this Portfolio.
Logical Operator
Logical Operator is using for decision-making, there are three main logical operators showed below.
4
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller micheleaccordino. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $53.20. You're not tied to anything after your purchase.