Simple (stupid) questions - no programming

This is a discussion on Simple (stupid) questions - no programming within the A Brief History of Cprogramming.com forums, part of the Community Boards category; Forgive me, I am a newb. Currently taking a Intro to C Programming class. I just received Visual Studio 2008. ...

  1. #1
    jvu
    jvu is offline
    Registered User
    Join Date
    Feb 2009
    Posts
    1

    Simple (stupid) questions - no programming

    Forgive me, I am a newb. Currently taking a Intro to C Programming class. I just received Visual Studio 2008. To program C, do I choose C++ (other options being C# and Visual Basic) as one of the options to write and build my code in? Also, what is the difference between a .h (header) and regular .c file? Is it just where you put all your variables and such?

  2. #2
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    You want to choose C++, but save your file with just a .c instead of .cpp, file extension.

    I'm waiting for some joker to tell you "choose Visual Basic!"

    The best way to understand what a header file is, is to look at them with Notepad or any plain text editor. Don't change them in any way, of course, but nothings better than seeing just what they really have in them, for yourself.

  3. #3
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,541
    Except most standard header files contain a lot of "necessary evil", and are not that good to learn from.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  4. #4
    For Narnia! Sentral's Avatar
    Join Date
    May 2005
    Location
    Narnia
    Posts
    719
    A header (.h) file is basically where you put your declarations and prototypes. While the .c file is mainly for the implementation of the stuff you put in the header. It's mainly for organization, so don't worry too much about it.
    Videogame Memories!
    A site dedicated to keeping videogame memories alive!

    http://www.videogamememories.com/
    Share your experiences with us now!

    "We will game forever!"

  5. #5
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913
    A header (.h) file is like the list of words in a phone that uses predictive text - it just says, "these are possible words" - it doesn't actually define them, it just says that they exist and people can use them. A .c file is like the dictionary - all the possible words are defined and detailed.

  6. #6
    In my head happyclown's Avatar
    Join Date
    Dec 2008
    Location
    In my head
    Posts
    391
    If you have any problems with Visual C++, feel free to post here. [EDIT: post in the Tech Forum]

    I've been using it for about 2 weeks now, so I've already encountered problems that you will no doubt run into.

    It's a great program, but it can be scary for a newbie.
    Last edited by happyclown; 02-04-2009 at 05:15 PM.
    OS: Linux Mint 13(Maya) LTS 64 bit.

  7. #7
    Its hard... But im here swgh's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,475
    Also be prepared for an onslaught of MS own warnings on C functions such as scanf, strcpy, fprint etc.. you can define a macro to get rid of them, im sure Cornedbee was kind enough to explain this in quite an old thread.

    To be perfectly honest, MSVC is a bit of an overkill for C, id use code::blocks or at a push WigexDevC++ and change the extention to .c
    I'm just trying to be a better person - My Name Is Earl

  8. #8
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,604
    Quote Originally Posted by swgh View Post
    Also be prepared for an onslaught of MS own warnings on C functions such as scanf, strcpy, fprint etc.. you can define a macro to get rid of them, im sure Cornedbee was kind enough to explain this in quite an old thread.
    *shrug* They are only trying to look out for your own well being and to help you find and debug errors, so I say they are perfectly justified.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  9. #9
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    SafeCRT is to Visual C++ what UAC is to Vista - a well-meant effort, but a horrible execution.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  10. #10
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,604
    We obviously love to disagree, but the thing is that they are easy to get rid of with wrappers and macros.
    Anyway, these are the two sides of the argument. Anyone is free to choose their own approach.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  11. #11
    a_capitalist_story
    Join Date
    Dec 2007
    Posts
    2,650
    Quote Originally Posted by swgh View Post
    Also be prepared for an onslaught of MS own warnings on C functions such as scanf, strcpy, fprint etc.. you can define a macro to get rid of them, im sure Cornedbee was kind enough to explain this in quite an old thread.
    Or add
    Code:
    #pragma warning(disable: 4996)
    to the start of the file.

  12. #12
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,604
    No, bad. It disables all deprecated warnings. Including those not for using the safe versions of the CRT.
    There is a define that you should use.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  13. #13
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,596
    _CRT_SECURE_NO_DEPRECATE
    Put that in the pre-processor section of the project settings.

  14. #14
    Chinese pâté foxman's Avatar
    Join Date
    Jul 2007
    Location
    Canada
    Posts
    404
    I'll add, for more info on Visual Studio, go look on MSDN: http://msdn.microsoft.com/en-ca/library/52f3sw5c.aspx.

    You'll find all the answer to your questions there.
    I hate real numbers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Simple GUI questions
    By spadez in forum C Programming
    Replies: 1
    Last Post: 02-20-2009, 04:02 PM
  2. A very long list of questions... maybe to long...
    By Ravens'sWrath in forum C Programming
    Replies: 16
    Last Post: 05-16-2007, 05:36 AM
  3. Some questions about Status Bars/Menus...
    By AoA in forum Windows Programming
    Replies: 8
    Last Post: 07-30-2006, 11:36 PM
  4. Yet Another Of My Stupid Questions
    By DeepBlackMagic in forum C++ Programming
    Replies: 3
    Last Post: 10-01-2003, 06:18 PM
  5. Incredibly Stupid People
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 9
    Last Post: 09-09-2003, 04:12 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21