User Tools

Site Tools


blog:spring2016:aslater1:journal

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
blog:spring2016:aslater1:journal [2016/05/03 02:43] – [May 2, 2016] aslater1blog:spring2016:aslater1:journal [2016/05/05 00:39] (current) – [May 4, 2016] aslater1
Line 176: Line 176:
 </code> </code>
 Where the "case #" is referring to the condition you're checking for. Don't forget the '':''! The use of a 'default' is optional, as well as the break. \\ Breaks can be omitted if you want the statement to "fall through" and hit multiple conditions.   Where the "case #" is referring to the condition you're checking for. Don't forget the '':''! The use of a 'default' is optional, as well as the break. \\ Breaks can be omitted if you want the statement to "fall through" and hit multiple conditions.  
 +====May 4, 2016====
 +Oh man, I just had all of the breakthroughs.
 +\\ \\ Turns out, if you're compiling multiple c files, and you simply use
 +<cli>
 +gcc file1.c file2.c file3.c -o combinedfiles
 +</cli>
 +Your functions won't be able to "talk" to each other. That is, you can run the program as many times as you want, but the function will never return anything (at least it wouldn't for me). How do you get around this? Header files! Which, by the way, are where the function prototypes go. Don't put the entire function in there.
 +\\ \\ 
 +So, when using multiple files you can just throw the above into a header file (making sure to include it in main). When you compile the c files functions work!
 +<code c 1>
 +#ifndef HEADERFILE_H_
 +#define HEADERFILE_H_
 +
 +int stuff(char this, char that);
 +
 +#endif
 +</code>
 +
 ======UNIX/Linux Fundamentals Journal====== ======UNIX/Linux Fundamentals Journal======
 ====January 25, 2016==== ====January 25, 2016====
blog/spring2016/aslater1/journal.1462243414.txt.gz · Last modified: 2016/05/03 02:43 by aslater1