Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

C question

Name: Anonymous 2009-05-26 12:38

What's the difference between writing int frozen() and int frozen(void)?

Name: Anonymous 2009-05-26 12:41

What's the difference between writing int frozen() and int?
One is a function declaration and the other is just a datatype.

Name: Anonymous 2009-05-26 12:42

inb4 shitty punchline involving a certain tripfriend.

Name: Anonymous 2009-05-26 12:43

>>1
0/10

Name: Anonymous 2009-05-26 12:55

Okay, one more thing;

#include <stdio.h>
#include <stdlib.h>

struct foo
{
  char fooc[20];
  int  fooi;
};

main()
{
  foo *bar;
  bar = (struct foo *) malloc(sizeof(foo));
  bar->fooi = 16;
  bar->fooc = "ANUX";
}



Why doesn't the bar->fooc assignment work? Sorry, I'm new to C.

Name: Anonymous 2009-05-26 12:59

>>5
because that's what strncpy() is for

Name: Anonymous 2009-05-26 13:06

Name: Anonymous 2009-05-26 13:16

>>6
Thanks!

Name: Anonymous 2009-05-26 13:29

>>7
FAQ THAT FAQ. They use non-standard faggot quotes. Hardly a document of any worth.

Name: Anonymous 2009-05-26 13:30

>>6
i prefer strdup

Name: Anonymous 2009-05-26 13:48

>>9
How are they ``nonstandard''?
>>2
main() vs main(void)
Seriously.

Name: Anonymous 2009-05-26 13:50

>>9
Have you read your The M4 macro processor today?

>>11
main() vs main(void)
Lurk more.
Seriously.

Name: Anonymous 2009-05-26 15:10

>>1

Your argument boils down to the fact that you suck at LISP and/or don't understand how computers work?

Look, there's no conflict between C and Lisp. If you want attention that badly, find a real issue to argue about.

Name: Anonymous 2009-05-26 15:51

>>11
They're nonstandard because they are not valid English quotes.

>>12
No, I do not read documents that contain faggot quotes, as they are nonstandard, unscientific, and ultimately destructive.

Name: Anonymous 2009-05-26 16:08

>>14
Is that even relevant to the topic, or is it just your way to say ``I haven't read SICP''?

Name: Anonymous 2009-05-26 16:59

if you declare a function as
int frozen();
then you can do call it with
frozen("faggot", 32, stdout);
which you can't do if you declare it as
int frozen(void);
now fuck off.

Name: Anonymous 2009-05-26 17:17

>>16
Get to fuck.

Name: Anonymous 2009-05-26 17:21

>>16
don't help him

Name: Anonymous 2009-05-26 18:06

>>16
That makes no sense. Is this really what you can do in C? Holy shit.

Why would you be able to call a function with parameters when the declaration has none?

Name: Anonymous 2009-05-26 18:08

>>19
so that the room is empty

Name: Anonymous 2009-05-26 18:44

>>19
WHBT

Name: Anonymous 2009-05-26 18:45

Another question;
I want the program to print lines of text, one at the time, after pressing enter. I thought of putting some moot scanfs between the printfs. Is there a better way to do this?

Name: Anonymous 2009-05-26 18:55

getchar

Name: Anonymous 2009-05-26 19:01

>>23
Thank you. I'll be sure to post more exciting questions in the future!

Name: Anonymous 2009-05-26 19:22

>>19
int frozen(); doesn't mean it has no parameters, just as frozen(void); doesn't mean it has no return type.

Name: Anonymous 2009-05-26 19:30

>>15
No, you put direct quotations in quotes, e.g. "Is that your way of saying 'I haven't read SICP'?"

This makes it a valid quotation.

Name: Anonymous 2009-05-26 19:31

>>19
Putting 0 parameters in a declaration means the number of parameters is unknown
>>5
Also, don't cast pointers in C.

Name: Anonymous 2009-05-26 20:11

>>27
Also, don't cast pointers in C.
You mean Sepples.

Name: Anonymous 2009-05-26 20:14

>>27
Also, don't cast pointers in C.
Enjoy not doing anything useful ever.

Name: Anonymous 2009-05-26 20:30

>>29
I will, along with my job.

Name: Anonymous 2009-05-26 20:31

>>29
You don't even understand the advice, do you?

Name: Anonymous 2009-05-26 22:04

whats the difference between

int frozen()

int __pascal frozen()

Name: Anonymous 2009-05-26 22:21

>>32
Nothing Wirth mentioning.

Name: Anonymous 2009-05-26 23:40

>>33
Sharp like a C, I see.

Name: Anonymous 2009-05-27 3:47

>>7
Please, moar such links.

Name: Anonymous 2009-05-27 3:54

Name: Anonymous 2009-05-27 4:11

>>36
Thank you.

Name: Anonymous 2009-05-27 5:29

>>28-29
Die, please.

Name: Anonymous 2009-05-27 6:34

>>29
Casting pointers is part of the power of C, but it's something that should be done rarely. Casting the return value of malloc() is bad, and a simple google will show the dozens of reasons for it.

Name: Anonymous 2009-05-27 16:00

There should be more threads like this on /prog/, helpful and insightful.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List