#Is it possible to use C on visual studio?
65 messages · Page 1 of 1 (latest)
When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.
Visual studio's C++ workload does support C.
Do I use .cpp files?
No, .c.
I can’t find a .c, am I looking at the wrong place?
what project type. I am mainly using it to mainly learn syntax atm
C++ project.
but there’s stuff like “console app” or “class library” and hundreds of others
Console app then.
i think so yes, otherwise it'll be full of .cpp files IIRC
Either empty project or console app.
been a minute since i did this
i got very annoyed by the version of C they were using, though -- that was back when they supported C89 and basically nothing else. nowadays you can specify that you wish to use C11 or C17 for more modern syntax
C23?
nope, not in MSVC
It should have opened automatically.
well, there’s header files, resource files, source files, and external dependencies
and references
Did you create an empty project?
I think so
sounds like it did open. you'll have to create a .c file in the source files thingy
So then you get started by right-clicking Source files and choose Add → New item.
You enter your source file name ending in .c.
but how to access that .c file after creating it?
Double-click it.
do I need any sort of code before I write what I want to write?
no? so long as you write code, anyways
I’m sorry if I sound pretty stupid, I am NEW new to C
should I take a look into keywords, reserved words, and some syntax?
the basic "hello world" file basically everyone starts with is (in C)```c
#include <stdio.h>
int main () {
printf("hello, world!\n");
return 0;
}
```the return 0 line is optional. you will have to learn all those other things -- for example, all the red words in that thing are keywords
We generally recommend a good book to learn the necessary fundamentals:
To actually write and run C code, you will need a compiler, editor, and debugger. We strongly recommend to start out using an IDE, which will provide all these tools for you:
- [Visual Studio](#1165492293810257920 message)
- CLion
do they have strings and characters?
Yes.
what is the
#include <stdio.h> for?
Go with a course, that will explain things to you.
sure, what can I use to learn?
#include <whatever> is a thingy that (generally) gives the compiler a list of functions and other definitions you can use to do whatever with. printf() is defined in stdio.h, hence stdio.h needs to be #included. the complete list of functions in stdio.h are
!man stdio.h
See the bot message above.
only a little, and not for this stage of learning. if you want to use linux, install WSL
I’m just gonna look at the basics and take notes on it
it could be a smart… or stupid choice to make
i recommend reading the man pages -- you could start by googling man 3 intro and man stdio.h and following the "See Also" sections until you get bored. you can also look up individual functions in the man pages via man 3 printf (the 3 is to make sure you get the right one -- man 1 printf also exists, most functions won't need that)
Wot.
I may have clicked the bot’s link
the “stdio(3)”
Well @mage is using Linux docs.
that page references a standard library header, it will be universal. there will be references to non-standard library functions that are linux-specific, but those will be rare, and not in the standard library header pages
Do you have any recommendations on what I could use to learn the basics of C?
there's the first 4 links in this and the man pages i linked. that should be more than enough to get started, i'd think
!solved