So a string in C is basically a linked list right?

So a string in C is basically a linked list right?

No, it's an array.

a null terminated array of positive integers.

A string is a string

sizeof(char*) + sizeof(char) is 9 bytes on my machine. That seems like a bad way to store a string.

not really, no.

Nope. In a linked list, each component of the list contains a link to the next component. The components of a C string are just chars. C strings are traversed by simply following the memory until you find a null character, therefore each component must be contiguous in memory. In a linked list the components do not need to be contiguous since it is traversed by following each pointer to somewhere else in memory.

Its a null terminated array of characters

> linked list
the most useless data structure.

>easy complete control and mutability
>simple to implement

0/10

Yeah but they're taught to make understanding trees easier, and trees actually are useful.

You could technically define your own version of a string to be anything you want it to be and re implement your own standard library functions which deal with strings.

Is a struct an array of diffrent data types ?

That's 8 byte pointers (64bit).
+
1 byte char

It's what you can do for the general case but for some specialized cases that's pretty bad.

Go read K&R

Retard

This must be the new bait post for Sup Forums. I have seen this before not long ago.

That would be a singleton.

array technically complies with linked list ADT

stacks technically comply with queues

This is the state of new devs coming into the market.

Mah use ruby because it’s expressive.

Op is just bait. At least I hope so if anyone knows what a linked list is then they should be able to look up what a string in C is

linked list is not an adt. List is. Dumb nigger.

Checked

So a linked list.

So a positionally-linked array (linked- list).

Kill yourself. I am not even a mean person. I never say this to people online. But literally. Take your own life. Your mother will be relieved.

no it's a dijkstra's tree

to this day i still don't understand the advantages of singletons over entirely static classes

Retard.

They can implement interfaces and be passed around I guess.

>So a linked list.
No, it's an array. They are not the same thing.

but if there's literally only one it, then what's the point of interfacing it?

i can come up with some abstract example of how do but i can't come up with a use case

so a linked list isnt always an array but all arrays are linked lists?

An array is basically a linked list of variables right?

No.
No.
True on modern architectures. Shifting a million of elements is still faster than inserting in a middle of a linked list(unless you have a pointer to the doesn't element you need to insert after - which is lets be honest never happens).

No. Array is a random-access data structure, list is a sequential data structure.

All efficient implementations of lists are arrays. But arrays are never lists.

>positionally-linked array (linked- list).
Oxymoron.

Is there a meaning to have static function in singleton class?

Ya (no)

How do this many people fall for the bait.

> (OP)
>A string is a string
t. pyfag