Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Document preview thumbnail
Preview 4 out of 55 pages
Summary

Summary programming

Document preview thumbnail
Preview 4 out of 55 pages

A note on the field of programming, how to learn programming and training courses for programming, learning programming from scratch to professionalism, learning programming for beginners to professionalism, programming languages

Content preview

Short Notes on C/C++




1

,• Structure of a program
– See ~zxu2/Public/ACMS40212/C++_basics/basics.cpp




Compilation Stages


– To see how the code looks after pre-processing, type
icc –A –E basics.cpp
2

,• Aggregates
1. Variables of the same type can be put into arrays or multi-D arrays, e.g.,
char letters[50], values[50][30][60];
Remark: C has no subscript checking; if you go to the end of an array, C won't
warn you.
2. Variables of different types can be grouped into a structure.
typedef struct {
int age;
int height;
char surname[30];
} person;

person fred;
fred.age = 20;
Remark: variables of structure type can not be compared.
Do not do:
person fred, jane;

if(fred == jane)
{
printf(“the outcome is undefined”);
} 3

, Pointers
• A variable can be viewed as a specific block of memory in
the computer memory which can be accessed by the
identifier (the name of the variable).
– int k; /* the compiler sets aside 4 bytes of memory (on a PC) to hold the value
of the integer. It also sets up a symbol table. In that table it adds the symbol k
and the relative address in memory where those 4 bytes were set aside. */
– k = 8; /*at run time when this statement is executed, the value 8 will be
placed in that memory location reserved for the storage of the value of k. */
• With k, there are two associated values. One is the value of the
integer, 8, stored. The other is the “value” or address of the memory
location.
• The variable for holding an address is a pointer variable.
int *ptr; /*we also give pointer a type which refers to the type of data stored at
the address that we will store in the pointer. “*” means pointer to */

4

Document information

School year
1
Uploaded on
July 19, 2023
Number of pages
55
Written in
2022/2023
Type
Summary
$6.89

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Sold
0
Followers
0
Items
43
Last sold
-


Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions