# include
void main (void)
{
char *s = 'Hello world';
printf("%s!\n", &s);
return void;
}
gcc is garbage why wont this compile
# include
void main (void)
{
char *s = 'Hello world';
printf("%s!\n", &s);
return void;
}
gcc is garbage why wont this compile
'stdio', not 'studio'
fatal error: 'stdio.h': No such file or directory
# include
^
compilation terminated.
shell returned 1
is this a joke?
No quotation marks, it's in the std library, not your directory.
If you're going to make babby tier mistakes then at least use an IDE that will do this for you.
stfu
still doesnt work stop trolling me
its obviously studio not stdio
stdio isnt even a word pls stop bulying me
plus obviously a string like that goe sin quotes
>can't write code properly
>blames the compiler
:think:
it compiles fine on clang
it's std
as in what shouko got from faceless men
wtf
test.c: In function ‘main’:
test.c:4:11: warning: character constant too long for its type
char *s = 'Hello world';
^~~~~~~~~~~~~
test.c:4:11: warning: initialization makes pointer from integer without a cast -Wint-conversion]
test.c:6:8: error: expected expression before ‘void’
return void;
^~~~
test.c:6:8: warning: ‘return’ with a value, in function returning void
test.c:2:6: note: declared here
void main (void)
^~~~
send help
#include
void main (void)
{
char *s = "Hello world";
printf("%s!\n", s);
}
This whole thread is bait.
return type should be int
also you beat me by about 10 seconds
learn the basics before you do pointers
Rather than this:
#include
Do this:
#include
The name of the header file has to be either enclosed in angle brackets or double quotes, but not anything else. Moreover, stdio.h is a standard header, but not studio.h.
Also, you have to use double quotes for hello world, not single quotes.
Beyond this...
The main function should return int, not void, and you should never have the "return void" statement in your program. That's implicit.
wow youguys are so smart how long did it take you to learn that
HAHAHAHAHAHAHAH
Double quotes around strings
No return values at all in a void function
You don't pass the address of a string pointer to printf
At least read up on the language a bit before trying to write something in it
...
Shouko a CUTE
we being raided by /lgbt/ trannys that think writing a for loop makes them a programmer?
hbtype = *p++;
n2s(p, payload);
pl = p;
wtf it wont work
why is Sup Forums so easy to bait?
> be softspoken weeb
> want to mayke a gayme
> try to use C
> can't import stdio
> post about it on a weeb forum
you'll never be anything but a neet
Should be
#include
is incorrect. If you're including locally, it should be "stdio.h", but if you're including from your include path, it should be
Your printf() call should be:
printf("%s!\n", s);
You're already passing a pointer to the string. You don't need the ampersand operator.
Your return statement should be:
return;
And at that note, use:
int main(void)
Because that's what the standard says you SHOULD use if you're taking no arguments. The reasoning behind this is that otherwise the return value is undefined, making it impossible for command line environments to assess whether the last executed program succeeded or not. It also makes it impossible to know why it failed.
This isn't about gcc. No compiler would accept this.
fuck clang
they have a brainlet complex, just look at these people desperate to prove they read the first page of k&r hhahahah
simply pathetic
uhh it compiles fine in clang idk what the heck your talking about
wtf i got it to compile and it just print sout garbage like ¤@!
^[[?1;2c
shell returned 5
$ clang 4chins.c
4chins.c:1:11: fatal error: ''studio.h'' file not found
# include
^
1 error generated.
reddit spacing
>No compiler would accept this
GCC and Clang will throw warnings. With -pedantic-errors, it will fail to compile.
you obviously dont have studio.h
Or wait, nevermind, I thought this was just in reference to using void main(void). The rest of the program is obviously in error.
console.out("hello world");
why would you ever use C for this usecase?
oh thanks, this one actually works
no one else itt was any help at all
Yeah, it's a reference to the entire program. void main(void) is not an error, just bad style and practice.
Just because people can write a coherent post doesn't mean they're from leddit, faggot.
how is desperately and pathetically trying to prove how smart you are by copying 'hello world' off stackoverflow a coherent post retard
it's okay user, you can be smart too
Haha
How should I go about learning C?
Because you're a fucking idiot
Its a bad meme. I saw him post the same thing in the desktop thread on /wg/. Just hide, ignore, sage, etc...
>C
Found your problem
Prove it
...
Holy shit, why won't you read the debug errors you fucking retard? user is right, just download Codeblocks and buy "The C programming language 2nd edition"