Skip to content

gustavogutierrezutp/is304

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is the course on data structures taught at Universidad Tecnológica de Pereira, Colombia. The course is taught in Spanish. In this site you will find practical information and supplementary material for the course.

Setting things up

Instructions

Development environment

Just once!!!!

git config --global user.name "Your Name"
git config --global user.email "youremail@yourdomain.com"
sudo apt-get install build-essential clang-format

Hello world

  1. Create the file pointers.cpp and paste the following code:
#include <iostream>

using namespace std;

int main() {
    int x = 10;
    int* p = &x; // Pointer to x

    cout << "Value of x: " << x << endl; // Output: 10
    cout << "Address of x: " << &x << endl; // Output: Address of x
    cout << "Value at pointer p: " << *p << endl; // Output: 10
    cout << "Address stored in pointer p: " << p << endl; // Output: Address of x

    *p = 20; // Change value at pointer p

    cout << "New value of x: " << x << endl; // Output: 20
    return 0;
}
  1. Open a terminal (Ctrl-ñ) and compile the file:
g++ -std=c++20 -o pointers pointers.cpp

This will create the file pointers (the executable!). To run it:

./pointers

About

Code from my data structures course

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors