User Tools

Site Tools


opus:fall2013:ddenunz2:journal

C/C++ Programming Journal

August 28th, 2013

Day one.

Class Website http://www/haas/fall2013/cprog

lab46.corning-cc.edu/haas/fall2013/cprog

Class introduction to lab46 Regained some familiarity with the lab46 server, trying to remember useful Unix commands.

  • SSH lab46 (to log in)
  • screen -r (reconnects to the class IRC)
  • Ctrl+d (disconnects from IRC)

August 29th, 2013

C - LAB 1

Joe attempted to re-familiarize the class with Bitbucket.org repository. CSCS1320F13 If not already Joe should have a rule of 3's

Functions -

  • Name
  • Input
  • Output

Variables -

  • Name
  • Value
  • Data Type

Hierarchy of programming language

  1. C - Higher level language
  2. Translate / compile (GNU Linux - gcc)
  3. Processor - Instruction set, machine code referred to as assembly

Preprocessing commands

#include <stdio.h> (has standard i/o functions like printf)

Hello World Program

Joe walked us through writing our first C program to gain some insight on how we use commands to get output from a program. So, opening vi editor and typing in the following commands gets us some output in the form of “Hello World”

Some of the basics of VIM I can remember:

  • Cursor navigation - h ←, k ↑, l →, j ↓
  • ESC for command mode
  • Exit vim with out saving- :q!
  • Save and exit - :wq or SHIFT+zz
  • x - deletes selected character
  • i - inserts , or a in command mode to append

Once our program was hastily written we needed to compile the program using GCC (GNU Compiler Collection). The command used was as follows. $gcc -Wall -o filename hello.c

GCC Manual - gcc.gnu.org Section 3 -

  • pre-processing
  • Compilation
  • Assembly
  • Link

August 30th, 2013

Not lost yet…

Class Repo - src/cprog

  • $mv *.c ~/src (move all files ending in .c to the src directory)
  • $mkdir ~/src/cprog (make directory in src called cprog
  • $mv *.c ~/src/cprog (moving all my .c files from src to new cprog dir)
  • hg status
  • hg add
  • hg commit -m
  • hg push
  • hg update
  • hg log

September 4th, 2013

Data Types C uses keywords for data types, there are 3 types of data

Integer Types (scalar)

  • char
  • short int
  • int
  • long int
  • long long int

Floating Point

  • float
  • double
  • long double

Pointers(memory variables) (composite)

  • Arrays
  • Structures
opus/fall2013/ddenunz2/journal.txt · Last modified: 2013/09/17 22:12 by ddenunz2