Thu Nov 26 19:44:13 2020
EVENTS
 FREE
SOFTWARE
INSTITUTE

POLITICS
JOBS
MEMBERS'
CORNER

MAILING
LIST

NYLXS Mailing Lists and Archives
NYLXS Members have a lot to say and share but we don't keep many secrets. Join the Hangout Mailing List and say your peice.

DATE 2008-06-01

HANGOUT

2020-11-26 | 2020-10-26 | 2020-09-26 | 2020-08-26 | 2020-07-26 | 2020-06-26 | 2020-05-26 | 2020-04-26 | 2020-03-26 | 2020-02-26 | 2020-01-26 | 2019-12-26 | 2019-11-26 | 2019-10-26 | 2019-09-26 | 2019-08-26 | 2019-07-26 | 2019-06-26 | 2019-05-26 | 2019-04-26 | 2019-03-26 | 2019-02-26 | 2019-01-26 | 2018-12-26 | 2018-11-26 | 2018-10-26 | 2018-09-26 | 2018-08-26 | 2018-07-26 | 2018-06-26 | 2018-05-26 | 2018-04-26 | 2018-03-26 | 2018-02-26 | 2018-01-26 | 2017-12-26 | 2017-11-26 | 2017-10-26 | 2017-09-26 | 2017-08-26 | 2017-07-26 | 2017-06-26 | 2017-05-26 | 2017-04-26 | 2017-03-26 | 2017-02-26 | 2017-01-26 | 2016-12-26 | 2016-11-26 | 2016-10-26 | 2016-09-26 | 2016-08-26 | 2016-07-26 | 2016-06-26 | 2016-05-26 | 2016-04-26 | 2016-03-26 | 2016-02-26 | 2016-01-26 | 2015-12-26 | 2015-11-26 | 2015-10-26 | 2015-09-26 | 2015-08-26 | 2015-07-26 | 2015-06-26 | 2015-05-26 | 2015-04-26 | 2015-03-26 | 2015-02-26 | 2015-01-26 | 2014-12-26 | 2014-11-26 | 2014-10-26 | 2014-09-26 | 2014-08-26 | 2014-07-26 | 2014-06-26 | 2014-05-26 | 2014-04-26 | 2014-03-26 | 2014-02-26 | 2014-01-26 | 2013-12-26 | 2013-11-26 | 2013-10-26 | 2013-09-26 | 2013-08-26 | 2013-07-26 | 2013-06-26 | 2013-05-26 | 2013-04-26 | 2013-03-26 | 2013-02-26 | 2013-01-26 | 2012-12-26 | 2012-11-26 | 2012-10-26 | 2012-09-26 | 2012-08-26 | 2012-07-26 | 2012-06-26 | 2012-05-26 | 2012-04-26 | 2012-03-26 | 2012-02-26 | 2012-01-26 | 2011-12-26 | 2011-11-26 | 2011-10-26 | 2011-09-26 | 2011-08-26 | 2011-07-26 | 2011-06-26 | 2011-05-26 | 2011-04-26 | 2011-03-26 | 2011-02-26 | 2011-01-26 | 2010-12-26 | 2010-11-26 | 2010-10-26 | 2010-09-26 | 2010-08-26 | 2010-07-26 | 2010-06-26 | 2010-05-26 | 2010-04-26 | 2010-03-26 | 2010-02-26 | 2010-01-26 | 2009-12-26 | 2009-11-26 | 2009-10-26 | 2009-09-26 | 2009-08-26 | 2009-07-26 | 2009-06-26 | 2009-05-26 | 2009-04-26 | 2009-03-26 | 2009-02-26 | 2009-01-26 | 2008-12-26 | 2008-11-26 | 2008-10-26 | 2008-09-26 | 2008-08-26 | 2008-07-26 | 2008-06-26 | 2008-05-26 | 2008-04-26 | 2008-03-26 | 2008-02-26 | 2008-01-26 | 2007-12-26 | 2007-11-26 | 2007-10-26 | 2007-09-26 | 2007-08-26 | 2007-07-26 | 2007-06-26 | 2007-05-26 | 2007-04-26 | 2007-03-26 | 2007-02-26 | 2007-01-26 | 2006-12-26 | 2006-11-26 | 2006-10-26 | 2006-09-26 | 2006-08-26 | 2006-07-26 | 2006-06-26 | 2006-05-26 | 2006-04-26 | 2006-03-26 | 2006-02-26 | 2006-01-26 | 2005-12-26 | 2005-11-26 | 2005-10-26 | 2005-09-26 | 2005-08-26 | 2005-07-26 | 2005-06-26 | 2005-05-26 | 2005-04-26 | 2005-03-26 | 2005-02-26 | 2005-01-26 | 2004-12-26 | 2004-11-26 | 2004-10-26 | 2004-09-26 | 2004-08-26 | 2004-07-26 | 2004-06-26 | 2004-05-26 | 2004-04-26 | 2004-03-26 | 2004-02-26 | 2004-01-26 | 2003-12-26 | 2003-11-26 | 2003-10-26 | 2003-09-26 | 2003-08-26 | 2003-07-26 | 2003-06-26 | 2003-05-26 | 2003-04-26 | 2003-03-26 | 2003-02-26 | 2003-01-26 | 2002-12-26 | 2002-11-26 | 2002-10-26 | 2002-09-26 | 2002-08-26 | 2002-07-26 | 2002-06-26 | 2002-05-26 | 2002-04-26 | 2002-03-26 | 2002-02-26 | 2002-01-26 | 2001-12-26 | 2001-11-26 | 2001-10-26 | 2001-09-26 | 2001-08-26 | 2001-07-26 | 2001-06-26 | 2001-05-26 | 2001-04-26 | 2001-03-26 | 2001-02-26 | 2001-01-26 | 2000-12-26 | 2000-11-26 | 2000-10-26 | 2000-09-26 | 2000-08-26 | 2000-07-26 | 2000-06-26 | 2000-05-26 | 2000-04-26 | 2000-03-26 | 2000-02-26 | 2000-01-26 | 1999-12-26

Key: Value:

Key: Value:

MESSAGE
DATE 2008-06-28
FROM Ruben Safir
SUBJECT Subject: [NYLXS - HANGOUT] C Programing Workshop
From lest-hangout-at-mrbrklyn.com Sat Jun 28 22:04:11 2008
Received: from www2.mrbrklyn.com (localhost [127.0.0.1])
by www2.mrbrklyn.com (8.13.1/8.13.1/SuSE Linux 0.7) with ESMTP id m5T248IJ023618
for ; Sat, 28 Jun 2008 22:04:10 -0400
Received: (from majordomo-at-localhost)
by www2.mrbrklyn.com (8.13.1/8.13.1/Submit) id m5T248HI023617
for hangout-outgoings; Sat, 28 Jun 2008 22:04:08 -0400
X-Authentication-Warning: www2.mrbrklyn.com: majordomo set sender to lest-hangout-at-nylxs.com using -f
Received: from www2.mrbrklyn.com (localhost [127.0.0.1])
by www2.mrbrklyn.com (8.13.1/8.13.1/SuSE Linux 0.7) with ESMTP id m5T246m3023614
for ; Sat, 28 Jun 2008 22:04:08 -0400
Received: (from ruben-at-localhost)
by www2.mrbrklyn.com (8.13.1/8.13.1/Submit) id m5T245Ng023613
for hangout-at-nylxs.com; Sat, 28 Jun 2008 22:04:05 -0400
Date: Sat, 28 Jun 2008 22:04:05 -0400
From: Ruben Safir
To: hangout-at-mrbrklyn.com
Subject: [NYLXS - HANGOUT] C Programing Workshop
Message-ID: <20080629020405.GB22523-at-www2.mrbrklyn.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
User-Agent: Mutt/1.5.6i
Sender: lest-hangout-at-mrbrklyn.com
Precedence: bulk
Reply-To: hangout-at-mrbrklyn.com

The C programming language was invented side by side with Unix. The King text goes through
much of the history of the language. Here I'd like to make a few points both in the general
and specific to GNU/Linux as a platform for C development.

Oxymoronic as it sounds C language is a bare bones specification without anything useful.
All it requires is the keyword main, which defines the root function that everything else
is piled into. Everything that C does is imported from external libraries. These libraries
are defined, in the simplist case, on top of your program.

For example, on page 10 of the King book is the following program:

#include

main(){
printf("To C, or not to C: that is the question \n");
}

which was inherited from the K&R text. The first line defines the
library stdio.h which c is to import. The main keyword is present
(which defines the required function main() to be explained later,
and the function printf which is defined in the library stdio.h.

Unlike programming languages such as Perl, Python and Rudy, C is a compiled
programming language. It needs a compiler to make a binary program that
can then be executed. The binary has machine like instructions which your
computer can directly understand. Unfortunately, your computer doesn't speak
English (or Spanish, Russian, Japanese, Manderin, Hebrew, or Udo). It speaks
binary. C is the interface between human language and machine code. The binaries
are very low level and C as a language, today, is considered to be very close to
the machine. You'd have to write programs in Assembly to get much close to your CPU.

Therefor, you need a C compiler to translate your C Programming text into machine code.
At one time suc compilers were expensive and hard to get. Thanks to Richard Stallman and
friends, today we have compilers on almost every GNU based system. That compiler is called
gcc. Compilers do three things: Parse, compile and link.

When you call:

gcc file.c

It loads file.c into the compiler. It then parses the programming you created and checks
for errors. It then analysis the symbols in your program and looks for their programming
definitions in the libraries that you call with #include. It then the different code
machine code peices it finds into a single binary.

The gcc compiler is very complex and learning C includes learning much about the compiler
and also the debugger, called gdb. Both are documented with man pages, and have full books
which are available from the Free Software Foundation and worthy additions to your library.
Both are included in the NYLXS library as references.

Any editor can be used to make C programs, but I strongly recommend learning either EMACS
or VI. EMACS has a GNU version, and VI has a version called VIM which can be downloaded and
used. I perfer the VIM editor and will use in in example and demonstrations. No editor
wars are needed here. I will say, however, if your using EMACS, then LEARN it. It is not
Microsoft Notepad.

After editing this first program run the following command on the command line:
For this workshop, the "$" or "ruben-at-www2:~/cprog>" is the shell prompt. Your prompt
on the NYLXS server will look like the second example.


$ gcc -Wall file1.c -o file1

the output will look like this:
ruben-at-www2:~/cprog> gcc -Wall file1.c -o file1
file1.c:3: warning: return type defaults to `int'
file1.c: In function `main':
file1.c:5: warning: control reaches end of non-void function
ruben-at-www2:~/cprog>


The compiler gives you 3 warning messages. I won't go into them currently, but in a few
weeks it should make sense to you. We will, however, fix the warnings later. For now, if
you look at your directory

ruben-at-www2:~/cprog> ls -l
total 12
-rwxr-xr-x 1 ruben staff 7041 2008-06-28 21:45 file1
-rw-r--r-- 1 ruben staff 86 2008-06-28 21:35 file1.c

file1.c is the file we are editing. You see it has no permisions to be executed.
file1 is the new executable we created. In addition. you see that it is executable.
gcc makes it executable permisions for us in most systems. We run our new program
on the command line like this:

ruben-at-www2:~/cprog> ./file1
To C, or not to C: that is the question

The C language defines the function main() and not much else. However, it is defined
as a function that returns an integer. We didn't return anything. We can fix this with
a "return function".

We return a 0 by convention unless we are trying to indicate an error or other message. We also
put the keyword 'int' infront of main which explicitly defines that main returns integers.

Our program not looks like this:

#include

int main(){
printf("To C, or not to C: that is the question \n");
return 0;
}

and when we compile:

ruben-at-www2:~/cprog> gcc -Wall file2.c -o file2
ruben-at-www2:~/cprog>

No warnings.

and when we run it, it looks like this:

ruben-at-www2:~/cprog> ./file2
To C, or not to C: that is the question
ruben-at-www2:~/cprog>



Next - Comments and C varriable basics.



--
http://www.mrbrklyn.com - Interesting Stuff
http://www.nylxs.com - Leadership Development in Free Software

So many immigrant groups have swept through our town that Brooklyn, like Atlantis, reaches mythological proportions in the mind of the world - RI Safir 1998

http://fairuse.nylxs.com DRM is THEFT - We are the STAKEHOLDERS - RI Safir 2002

"Yeah - I write Free Software...so SUE ME"

"The tremendous problem we face is that we are becoming sharecroppers to our own cultural heritage -- we need the ability to participate in our own society."

"> I'm an engineer. I choose the best tool for the job, politics be damned.<
You must be a stupid engineer then, because politcs and technology have been attached at the hip since the 1st dynasty in Ancient Egypt. I guess you missed that one."

© Copyright for the Digital Millennium

  1. 2008-06-03 Ruben Safir <ruben-at-mrbrklyn.com> Subject: [NYLXS - HANGOUT] [nyc-at-workatjelly.com: Jelly in Manhattan this Friday, 6/6]
  2. 2008-06-08 Ruben Safir <ruben-at-mrbrklyn.com> Subject: [NYLXS - HANGOUT] Empathic Computing
  3. 2008-06-08 Ruben Safir <ruben-at-mrbrklyn.com> Subject: [NYLXS - HANGOUT] GMAIL - Free Software Models
  4. 2008-06-08 Ruben Safir <ruben-at-mrbrklyn.com> Subject: [NYLXS - HANGOUT] Cellphone DO kill ....
  5. 2008-06-08 Michael L Richardson <mlr52-at-michaellrichardson.com> Re: [NYLXS - HANGOUT] Cellphone DO kill ....
  6. 2008-06-08 Ruben Safir <ruben-at-mrbrklyn.com> Subject: [NYLXS - HANGOUT] Bloody Ugly
  7. 2008-06-12 Ruben Safir <ruben-at-mrbrklyn.com> Subject: [NYLXS - HANGOUT] [nyc-at-workatjelly.com: Jelly in Brooklyn this Friday, 6/13]
  8. 2008-06-12 Ruben Safir <ruben-at-mrbrklyn.com> Subject: [NYLXS - HANGOUT] [notification+zjaayj4y-at-facebookmail.com: "The Rooftop Films Summer Series: June Schedule" sent you a message on Facebook...]
  9. 2008-06-12 From: "armando fonseca" <afonsec2-at-gmail.com> Subject: [NYLXS - HANGOUT] armando fonseca wants to chat
  10. 2008-06-20 Ruben Safir <ruben-at-mrbrklyn.com> Subject: [NYLXS - HANGOUT] [KMalhotra-at-council.nyc.gov: Tech in Government Update]
  11. 2008-06-20 Ruben Safir <ruben-at-mrbrklyn.com> Subject: [NYLXS - HANGOUT] [meissner-at-suse.de: [security-announce] SUSE Security Announcement: evolution (SUSE-SA:2008:028)]
  12. 2008-06-20 Ruben Safir <ruben-at-mrbrklyn.com> Subject: [NYLXS - HANGOUT] [dplist-at-danielpipes.org: #862: Pipes argues "The Enemy Has a Name" in the Jer. Post]
  13. 2008-06-20 Ruben Safir <ruben-at-mrbrklyn.com> Subject: [NYLXS - HANGOUT] [meissner-at-suse.de: [security-announce] SUSE Security Summary Report SUSE-SR:2008:013]
  14. 2008-06-20 Ruben Safir <ruben-at-mrbrklyn.com> Subject: [NYLXS - HANGOUT] [meissner-at-suse.de: [security-announce] SUSE Security Announcement: Opera 9.50 (SUSE-SA:2008:029)]
  15. 2008-06-20 Ruben Safir <ruben-at-mrbrklyn.com> Subject: [NYLXS - HANGOUT] [chief-at-freesoftwaremagazine.com: [Fsm_newsletter] Free Software Magazine newsletter]
  16. 2008-06-20 Ruben Safir <ruben-at-mrbrklyn.com> Subject: [NYLXS - HANGOUT] [anthony.weiner-at-congressnewsletter.net: Reminder - Town Hall with Rep. Weiner]
  17. 2008-06-20 Ruben Safir <ruben-at-mrbrklyn.com> Subject: [NYLXS - HANGOUT] Geek Dinosaur News
  18. 2008-06-20 Ruben Safir <ruben-at-mrbrklyn.com> Subject: [NYLXS - HANGOUT] More Geek stuff - 2000 year old Jew Tree's
  19. 2008-06-21 Ruben Safir <ruben-at-mrbrklyn.com> Subject: [NYLXS - HANGOUT] AP Copyright and Bloggers
  20. 2008-06-21 Ruben Safir <ruben-at-mrbrklyn.com> Subject: [NYLXS - HANGOUT] Diamonds are a girls best friend
  21. 2008-06-22 Ruben Safir <ruben-at-mrbrklyn.com> Subject: [NYLXS - HANGOUT] [jays-at-panix.com: [nylug-talk] Sunday 22 June 2008 NYC Resistors: OLPC Hack Day]
  22. 2008-06-22 Ruben Safir <ruben-at-mrbrklyn.com> Subject: [NYLXS - HANGOUT] Tea Lounge
  23. 2008-06-22 Ruben Safir <ruben-at-mrbrklyn.com> Subject: [NYLXS - HANGOUT] Next NYLXS Meeting
  24. 2008-06-22 Ruben Safir <ruben-at-mrbrklyn.com> Subject: [NYLXS - HANGOUT] [ruben-at-mrbrklyn.com: [nylug-talk] Internships for Teens?]
  25. 2008-06-22 Ruben Safir <ruben-at-mrbrklyn.com> Subject: [NYLXS - HANGOUT] OLPC MS Spin
  26. 2008-06-23 From: "Michael L. Richardson" <mlr52-at-mycouponmagic.com> Re: [NYLXS - HANGOUT] Next NYLXS Meeting
  27. 2008-06-23 Ruben Safir <ruben-at-mrbrklyn.com> Subject: [NYLXS - HANGOUT] [catch152-at-gmail.com: Re; Signing up.]
  28. 2008-06-23 Amy Coleman <acoleman-at-mrbrklyn.com> Re: [NYLXS - HANGOUT] Next NYLXS Meeting
  29. 2008-06-23 Ruben Safir <ruben-at-mrbrklyn.com> Subject: [NYLXS - HANGOUT] Some Brooklyn History with Photo's! Worth a look.
  30. 2008-06-24 Ron Guerin <ron-at-vnetworx.net> Re: [NYLXS - HANGOUT] Tea Lounge
  31. 2008-06-24 Ruben Safir <ruben-at-mrbrklyn.com> Subject: [NYLXS - HANGOUT] [nyc-at-workatjelly.com: Jelly in Brooklyn this Friday, 6/27]
  32. 2008-06-24 Ruben Safir <ruben-at-mrbrklyn.com> Re: [NYLXS - HANGOUT] Tea Lounge
  33. 2008-06-24 Ruben Safir <ruben-at-mrbrklyn.com> Subject: [NYLXS - HANGOUT] [Consultants1-at-cgt-consult.com: Open Jobs]
  34. 2008-06-24 Ruben Safir <ruben-at-mrbrklyn.com> Subject: [NYLXS - HANGOUT] Data Recovery Tools
  35. 2008-06-26 Ruben Safir <ruben-at-mrbrklyn.com> Subject: [NYLXS - HANGOUT] News not getting enough press
  36. 2008-06-28 Ruben Safir <ruben-at-mrbrklyn.com> Subject: [NYLXS - HANGOUT] Video Production
  37. 2008-06-28 Ruben Safir <ruben-at-mrbrklyn.com> Subject: [NYLXS - HANGOUT] The new DMCA
  38. 2008-06-28 Ruben Safir <ruben-at-mrbrklyn.com> Subject: [NYLXS - HANGOUT] On Line C, Perl and C++ Programming Work Shop
  39. 2008-06-28 Ruben Safir <ruben-at-mrbrklyn.com> Subject: [NYLXS - HANGOUT] C Programing Workshop
  40. 2008-06-29 Ruben Safir <ruben-at-mrbrklyn.com> Subject: [NYLXS - HANGOUT] [ivaldes-at-hal-pc.org: [Hardhats] Congress Health IT Bill and Cerner Lobbying]y
  41. 2008-06-29 From: "Ronny Abraham" <ronny.coder-at-gmail.com> Re: [NYLXS - HANGOUT] C Programing Workshop
  42. 2008-06-29 Ruben Safir <ruben-at-mrbrklyn.com> Re: [NYLXS - HANGOUT] C Programing Workshop
  43. 2008-06-29 From: "Ronny Abraham" <ronny.coder-at-gmail.com> Re: [NYLXS - HANGOUT] C Programing Workshop
  44. 2008-06-29 Ruben Safir <ruben-at-mrbrklyn.com> Re: [NYLXS - HANGOUT] C Programing Workshop
  45. 2008-06-29 From: "Michael L. Richardson" <mlr52-at-michaellrichardson.com> Re: [NYLXS - HANGOUT] Video Production
  46. 2008-06-29 email <ray-pub-at-rcn.com> Re: [NYLXS - HANGOUT] C Programing Workshop
  47. 2008-06-29 Ruben Safir <ruben-at-mrbrklyn.com> Subject: [NYLXS - HANGOUT] C++ Workshop session 1
  48. 2008-06-30 From: "Ronny Abraham" <ronny.coder-at-gmail.com> Re: [NYLXS - HANGOUT] C Programing Workshop
  49. 2008-06-30 Ruben Safir <ruben-at-mrbrklyn.com> Re: [NYLXS - HANGOUT] C Programing Workshop
  50. 2008-06-30 swd <sderrick-at-optonline.net> Subject: [NYLXS - HANGOUT] Need to get rid of a whole bunch of programming books. TALK ABOUT FREE
  51. 2008-06-30 Ruben Safir <ruben-at-mrbrklyn.com> Re: [NYLXS - HANGOUT] Need to get rid of a whole bunch of programming books. TALK ABOUT FREE SOFTWARE!!!
  52. 2008-06-30 From: "Tameek Henderson" <tameek-at-gmail.com> Re: [NYLXS - HANGOUT] Need to get rid of a whole bunch of programming books. TALK ABOUT FREE SOFTWARE!!!
  53. 2008-06-30 Ruben Safir <ruben-at-mrbrklyn.com> Re: [NYLXS - HANGOUT] Need to get rid of a whole bunch of programming books. TALK ABOUT FREE SOFTWARE!!!

NYLXS are Do'ers and the first step of Doing is Joining! Join NYLXS and make a difference in your community today!