You should be able to solve this

You should be able to solve this

The type you declare it to be

int
double
int
const char *

Not sure about the last one.

int, float/double, char, char*.

back to /r/programming please

What did he mean by that?

int
float
int
string

var, var, var , var, var

>c
>string

>5 vars when question was asking for 4 types
web designer detected

int, double, char, const char*

0,
0.0,
'0',
"0"

The assignments would cast them if there were any, but as they're freestanding and not suffixed...

const void, const void, const void, const void *

I'm 2 weeks into my CS degree and shit I have no idea what's the last one.

int
float
char
constant char?

short, double, char, char*
well there's a few valid answers to this really

"0" is of type char[n], where n is the size plus one for \0. Otherwise sizeof wouldn't work correctly.

(It's one other three cases where an array expression doesn't decay to a pointer, the others being when used with sizeof and &)

I hate C.

See it as what the correct types of the variables are that can be assigned to these values.

In C there are no "strings" like in C++
There's an array of char
so
"Hello" in C++
would be
['H', 'e', 'l', 'l', 'o'] with an optional '\0' at the end of the array

Depends, depends, depends, const char *

If I declare something like

char hello* = "hello user";

does C append the '\0' for me automatically?

number, decimal, byte string, real string

char * is the type
so it'd be
char * hello = "hello user";
and I don't think so, no. So it'd just start spewing out random shit.
I don't really use C, I learned C++ instead, so I might be wrong a bit

Yes.
There's no such thing as const void.
0.0 is double, 0.0f would be float.

yes, you are wrong

int literal
double literal
char literal
string literal

this

>' '
>int
kek

int
float/double (should be 0.0F)
char
char array with null terminator

>C
>string

' ' is int

Dumbass

>mfw when not a single person posted the correct answer itt

It's

int
double
int
char[1]

Learn C jeez

decimal, float or double?

Int
Double
Char
Char[]
I don't even know c

0 :: int
0.0 :: double
'0' :: char
"0" :: char *

You are quite retarded my friend
char* sumshit =malloc(10);

Is just another notation for:
char sumshit[10];

char, char, char, char*

int
float
int
const char[2]

printf("%i %i %i %i\n",sizeof(0), sizeof(0.0), sizeof('0'), sizeof("0"));


>int, double, int, char[2]

Not that guy, but you're wrong

malloc(10) allocates memory on the heap, char sumshit[10] allocates memory on the stack

int
double
char
char*/const char*

This is correct, except for float

>So it'd just start spewing out random shit
Nope.
You can printf it, and since it's null terminated, it'll print exactly what it is.
strlen also works, just as if it were a char[ ], with manual null termination.

double integers are fucking retarded

go fuck yourself

>double integers are fucking retarded
>double integers
>double
>integers
>retarded

you sir are the only retarded one here

Not an expert at C, but...

>int
>float
>char
>char*

That's what you would expect, but it's not the right answer

What is the right answer then?

Pointer inside a pointer
Lag
Deprecated
Goto statement

>Implying I know how to code
>Implying I know what a type is
>Implying I even know what the fuck C is

I have no idea what the fuck any of you are talking about and fail to see how it's beyond anything more than gibberish nonsense. I tried several times and it's like above-basic science and maths, I just cant get the shit in my head. There are some things in life you know you'll never get around to doing or understanding and any kind of programming is one of them for me.

int
double
int
char[2]

the 90% of Sup Forums right here

I lol'd

>Learn C jeez
why?
it's pointless.

It's pointless for the high-level scrubs maybe

The benefits of knowing C include
>beard growing twice as fast
>get angry at noobs who can't memorize the entire standard
>dream in code

Ok, everybody done guessing? Here's the answer, which nobody has got so far.

int
double
int
const char[2]

>ITT: Illiterate people that doesn't know that char is just a short int

...

>Short signed integer type. Capable of containing at least the [−32767, +32767] range;[3][4] thus, it is at least 16 bits in size.

Doesn't matter, float has an f on the end so it's double based retard.

>he doesn't know that it's implementation defined
>he doesn't know char is the smallest type (sizeof(char) == 1)
>inb4, "i was only pretending!"

There is a greater issue at hand here than these kids knowing or not knowing C types.

The issue is why the fuck is 'a' type of int. In other words why the fuck is type of CHAR literal INT?

This is correct. There are however some cases where the constness can be lifted.

You people can't claim to know C if you haven't even read the specification.

Lmao char is guaranteed to be 1 byte and short has to be at least be 16 bit (where CHAR_BIT ==8).

why can't the first one be bool?

>bool
>C
plz go away

Int, Double, 48, Char

typedef int bool;

Gratz, you just renamed int

something integer
something floating point
i don't care
will fix when compiler complains

3/4, pointers and arrays are different types
1/4, 0.0f would be a float
2/4, what is a string
0/5
2/4, character literals are actually ints in C, unlike C++.
0/4, I'm not even sure of any of those is an actual type
1/4
1/4, no there aren't, literals have types
It's actually const char[n], an array of const characters. Attempting to modify the characters in a string literal is undefined behaviour.
0/4
0/4
2/4. I mean, these are kinda all right, but the type of a character literal is int and the type of a string literal is const char[n].
1/4, 0.0 is a double and 0.0F is a float, both are valid literals
3/4, close but the string literal has a null terminating byte so it's const char[2]
0/4. Oh you didn't mean to capitalize them? 2/4
2/4
0/4
3/4, you got the hard one
3/4
2/4
1/4
3/4
Jeez come on guys, memorize the standard already

char[999]

I'm curious, what are some of those cases? Do you mean it's okay to assign a const char[] to a char *, or that the type of a string literal is actually char [] in some cases, or what?

The specification allows architectures to implement mutable string literals to save small amounts of static storage.

CHAR_BIT doesn't actually have to be 8, so on some pathological architectures you could have char and short the same size, both 16 bits (but it would still be called one byte and you'd have sizeof(char) == sizeof(short) == 1).

integer
float
char
array

C compilator has no bool.
You can include library as part of C standard library.

int
float
int
const char[2]

>Oh, you didn't mean to capitalize them?

This is horrid autism.

More like this is programming

Shit matters

>Jeez come on guys, memorize the standard already
the last one is a fucking pointer to a char, you want us to say int or what?
const char* or simply char* is good.

>MOOOOM! THE COMPILER'S BEING AUTISTIC AGAIN!

No it's not, it's an array of const char. Check what sizeof("0") is. You can assign it to a pointer to the first element, but on its own it's an array. Pointers and arrays are different.

10/10 autism

PEOPLE NEED TO KNOW THEY'RE WRONG ON THE INTERNET

In C you can define an array with a pointer.
char* is a pointer to a char.
a string is an array of char.
you can use char* to define an array of char aka string.
>Pointers and arrays are different.
????

#include

int main() {
char str[5] = {'d', 'o', 'p', 'e', '\0'};
printf("*str: %c\n", *str);
printf("str[0]: %c\n", str[0]); //same are previous line
printf("*str + i: ");
for(int i = 0; i < 5; ++i)
printf("%c",*(str + i)); //pointer to adresses next to str
printf("\n");
return 0;
}

Arrays are define by pointers, you can simply define a pointer to a single char, but, WITH THE SAME SYNTAX, you can define an ARRAY OF CHAR, the difference come after if you reserve memory with malloc, calloc, ...
If I'm wrong enlight me with your knowledge, spedgelord.

>he doesn't know what the fuck he is talking about

i use python

don't care lol

confirmed for retard

int, float, char, char *

>i use python

this

int, float, char, const char*

Why should i? I don't give a shit about programming.

int, float/double (machine dependent), char, const char*

The difference between pointers and arrays is seen only in a few cases, like sizeof and possibly some stuff with & and pointer arithmetic. Array names can decay to pointers in most cases, which makes them look the same.

int
double
int
const char[2]

>memorize the standard
Or we can be like you and shitpost on Sup Forums after reading a chapter of K&R

int, float, char, const char*

But I'm a hardware guy :\ all your code means fuck all if the hardware isn't working properly.

int
float
char
string