2014/10/21 things commenly bought in cases water would be a data type each holds 6 packs of water but it onlys stores water so its an array ie acesses 6 pack element 1 multi dimensional array
sixpack[] []commen means of accessing information one variable with 6 total addresses go to spot in array and set loop put value in the array at its indicated address total = sum(scores,num); function call sum is an argument that is passed the scores array providing the array and total size it is occupying sum will summ the scores return it and assign it summ will return int and assigined to total
call sum get result call highest get result call lowest get result wiht each call it is assigined name and parameters first parameter to sum was an interger pointer avg is a float
main is completed define the first of the 4 functions the prototype above is a prototype that is going to be used in the future in the seocond half is a definition int sum int n in the fucnction has a diffrent name assigned to it and it is not the same whatever youc call it there are 2 sepreate variables being created /* run this program using the console pauser or add your own getch, system(“pause”) or input loop */
#include <stdio.h> #include <stdlib.h>
int sum(int *, int); float average(int, int); int sum(int*arr,int n)with a function you can return more values int main() { int highest(int *, int); int lowest(int *, int); int i,num=0 make sure to set to 0 because your going to add to it num is the running total
int num = 4; int high, low; int scores[num]; int i, total = 0; float avg;
for (i = 0; i < num; i++) int sum(int*arr,int n)//with a function you can return more values arr [1]//add it to the array as another variable num = num+arr[1]// to get the value back add { return (0) // come up with
2014/07/09
new1
#include<stdio.h>
int main()
{
int a; int b; int c; int d; float avg;
printf("enter score 1:"); scanf("%d",&b);
printf("enter score 2:"); scanf("%d",&b);
printf("enter score 3:"); scanf("%d",&c);
printf("enter score 4:"); scanf("%d",&d);
avg = (float)0 (a+b+c+d)/4;
printf("The average of %6.4d,%d,%d,%d is %.2f\N",a,b,c,d,avg);
return (0);
}
int score [4] score [0] = 73; score [1 = 86; score [2] =99; score [3] = 92; Int score [] = {73,86,99,92} ;
for any given input file, the file name files either into several assembler input files, or into one assembler input file; then each assembler input file produces an object file, and linking combines all the object files (those newly compiled, and those specified as input) into an executable file. For any given input file, the file name suffix determines what kind of compilation is done:
gcc-E -o peed;some.p2-S read code to see what is readable and not
fhs file system hierarchy stranded
2s compliments negative numbers start out with the negative numbers largest negative on top
%d signed int %u unsigned int %x/%x 4 bit hex values %c ascii characters %hd is half of the interger 4 hd would be 2 %hhd - half half signed int when using a 1 bit data type, unless specified it will be displayed as 4 bits
its good to return a value
variables- 73 interger 3.14 'c' character “hello” array of char (aka “string”) “” double quotes is single '' is many “hello\0” 0 is a null character memory addresses 0xdeadbeef
variables
ex. a user name
to make a variable declare the type (name) type name = (0) type name = 0;so you can name it later
int char %d means subsitute in a charachter %x
var1.c
#include<stdio.h> int main() { int a; int b,c; int *d; char e,*f; e = 'x' ; d = & c ; printf(“address of a %p\n,”&a),
printf(“a contains: %d/n,”a);
irrsi commands screen - ls if no socket
irssi server irc join csci join lab46
accessing and storing data to bit bucket using a cli
hg clone Https://joppenhim@bitbucket.org/joppenhim/cscs132 using own user name
..\hg add hope.txt up one level in the files dirrectory [web]
create a short cut for cmd.exe
change drive to blank in properites menu path=\tools\tortoisehg%path%
create new bat document edit the folder with path=\tools\tortoisehg%path%
in cmd properties go to shortcut and change the target info a the end with/k followed by the batch file that you want to run
nano hello.c sets the drive location and opens the file to be writen to
#include<stdio.h> in line file loader loads contents of file in place
c standerd library putting the file name in () will have it look in the same directory
man 3 printf programming manual
renturn type or value for y y=f is the name (x) is the parameters
file pointers
stdin stdout is out put screen stderr is screen as well
anyhthing in quotes are a string and you can use commas inside the quotes to denote
\n is an escape character
a visual tab is \ t
would be a back slash
int main ()
GNU nano 2.2.6 File: hello.c
#include <stdio.h>
int main()
{fprintf(stdout, "hello, world\n");
return (0); }
#include <stdio.h> #include <stdlib.h>* value =atoi(argv[]) /* run this program using the console pauser or add your own getch, system(“pause”) or input loop */ int main(int argc, char *argv[]){ * an array of characters is a string an array of charachters is a string
int i; printf(“you called %s with %d arguments:\n”, argv[0], argc-1); printf(“argument breakdown as follows:\n”);
for(i=0; i<argc;i++) printf(“argv[%d]: %s\n,i,argv[i]”); return 0;
}
ls shows any and all saved files on the drive gcc-ohello hello.c
fprint(stdout,
file pointer