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

Pages: 1-4041-

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.

Name: Anonymous 2009-05-28 16:35

>>7
http://c-faq.com/misc/binaryfiles.html
Q: How can I write data files which can be read on other machines with different word size, byte order, or floating point formats?
A: The most portable solution is to use text files (usually ASCII), written with fprintf and read with fscanf or the like. (Similar advice also applies to network protocols.) Be skeptical of arguments which imply that text files are too big, or that reading and writing them is too slow. Not only is their efficiency frequently acceptable in practice, but the advantages of being able to interchange them easily between machines, and manipulate them with standard tools, can be overwhelming.
Why would you give a link to such thing? ;_;

Name: Anonymous 2009-05-28 23:57

Hosted by ESKIMO NORTH
http://www.eskimo.com/
WHAT

Name: Anonymous 2009-05-29 0:23

>>42
Masticating monkeys! This is an outrage! I demand something be done with it at once!

Name: Anonymous 2009-05-29 0:36

>>42
hahahaha, this site is awesome.
almost every picture has a full paragraph of alternative text

Name: Anonymous 2009-05-29 0:51

>>44
Not at all. Every picture has a short, descriptive alternative text. A lot of the links have huge titles, though. In a certain sense you could say the site is actually well designed. (The "I am blind and/or just read the html in my text editor" sense.)

Name: Anonymous 2009-05-29 1:13

>>45
In a certain sense you could say the site is actually well designed.
Yeah, almost as ``well designed'' as PHP.

Name: Anonymous 2009-05-29 1:47

Who is frozenvoid? I know hes a tripfag that you hate, but why?

Name: Anonymous 2009-05-29 4:04

>>47
well, for one he vowed to destroy the corrupt and evil land of 4chan on several occasions

Name: !WokonZwxw2 2009-05-29 5:16

>>48
No, that would be me.

Name: Anonymous 2009-05-29 8:52

>>7
Q: Here are some cute preprocessor macros:

    #define begin    {
    #define end    }

With these, I can write C code that looks more like Pascal. What do y'all think?

IHBT.

Name: Anonymous 2009-05-29 9:05

Q: Why is the macro

    #define TRACE(n) printf("TRACE: %d\n", n)

giving me the warning ``macro replacement within a string literal''?

IHBTA.

Name: Anonymous 2009-05-29 10:26

I HAVE ANOTHER QUESTION

When can I make use of value returned by main? Example please?

Name: Anonymous 2009-05-29 10:45

IF ERRORLEVEL 1 GOTO ERROR

Name: Anonymous 2009-05-29 10:52

>>52
int main              (
 int argc, char **argv
)                              {
 return (1 + main(argc, argv));
}

Name: Anonymous 2009-05-29 10:54

>>41
What's wrong with the advice? What the fuck do you want, binary files? XML?

Name: Anonymous 2009-05-29 11:17

>>54
EXPERT OPTIMISER

Name: Anonymous 2009-05-29 11:46

>>56
Wait what do you mean?

Name: Anonymous 2009-05-29 11:51

>>57
I mean, I never thought of optimising my code that way. Cool function bro.

Name: Anonymous 2009-05-29 11:51

After reading this thread I have come to the conclusion that nobody on /prog/ actually programs.

Including me :)

Name: Anonymous 2009-05-29 12:07

>>59
OK YOU JUST FUQIN ANGERED AN EXPERT PROGRAMMER etc etc etc.

Name: Anonymous 2009-05-29 12:40

>>58
How is that optimizing

Name: Anonymous 2010-12-17 1:25

Are you GAY?
Are you a NIGGER?
Are you a GAY NIGGER?

If you answered "Yes" to all of the above questions, then GNAA (GAY NIGGER ASSOCIATION OF AMERICA) might be exactly what you've been looking for!

Name: Anonymous 2011-02-04 12:26


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