2

What is the size of a node? and where are the data recorded?

 2 years ago
source link: https://www.codesd.com/item/what-is-the-size-of-a-node-and-where-are-the-data-recorded.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

What is the size of a node? and where are the data recorded?

advertisements

As the question implies,what's the size of usual node:

struct node{
   int data;
   node* next;
};

If the struct holds the data and the address of next node, what's the size of the pointer address(not what it points to)? Is there a difference if the next points to NULL?

where is the data(which is not a pointer) saved, stack or heap, if I made "new node":

node* linkednode= new node;

Are the answers change if I made class node?


You can easily check those using the sizeof() function applying it not only to your int and pointer variables but for the node itself. Usually ints and pointers are 4 bytes on 32 bit platforms, so this is implementation defined and might vary on other platforms. The total size of node might be equal to 8 but might not due to the cause specified above and\or data alignment.

Related Articles

What is the data type of 'MyActivity.this' - Android

well my question is that there aren't pointers in JAVA ... but when we have to start another activity we do like this : Intent in = new Intent(MyActivity.this, NewActivity.class); startAcitivity(in); So my question is that what is the data type of My

How to recover / restore the data (records) of my MySQL database on a corrupted hard disk?

A few days ago my hard drive crashed (no booting anymore). On this hard drive was a MySQL installation with a database (called "db_cedar"). Meanwhile, I could connect the corrupted hard drive as a second hard drive to my computer. That means I h

What are the imported class files and where are they imported from?

What is the meaning import classes and from where are they imported from? Example package game; import game.sprites.PlayerSprite; import java.applet.Applet; import java.awt.*; import java.io.*; import java.net.URL; import java.util.Vector; import lit

What is the difference in the purpose of TO and MAKE, and where are they documented?

I feel like I understand MAKE as being a constructor for a datatype. It takes two arguments... the first the target datatype, and the second a "spec". In the case of objects it's fairly obvious that a block of Rebol data can be used as the "

Java: What is index-based access to arrays and why are they fast?

I keep reading that searching is faster in ArrayList, as it is index based, in comparison with some other data structure like LinkedList. I understand that an ArrayList internally uses a Java array. Here is the code from Java's ArrayList that holds t

What is the data structure behind the Clojure sets?

I recently listened to Rich Hickey's interview on Software Engineering Radio. During the interview Rich mentioned that Clojure's collections are implemented as trees. I'm hoping to implement persistent data structures in another language, and would l

Python: for-iteration through a string utf-8 - & gt; What is the data / coding type of the iterators?

I have a utf-8 encoded strings(mainly Chinese + some english), and want to run a letter count on them. (similar to English word count). So I used for letter in text: # text is a utf-8 encoded str but I'm not sure what I'm getting as a 'letter'. 'text

What is the date format for & ldquo; From & rdquo; Annotation in javadoc?

I've tried googling this but didn't find a complete answer to this question: Can I set the date format for the @since annotation in javadoc? Or how do I see what format is set?The @since tag should be used to define which version you added the method

How to update the data record using angularJS and Laravel?

I'm a beginner and I'm creating a simple CRUD system using AngularJS and Laravel 5. I'm having problems implementing/making the UPDATE feature (to edit data) work. Every time I run it, I keep getting this error on my browser console: No 'Access-Contr

What is the data structure of this variable in Perl?

I am new to perl and reading a code written in perl. A line reads like this: $Map{$a}->{$b} = $c{$d}; I am familiar with hash looking like %samplehash and accessed as $samplehash{a}="b" but what does the above line say about what is Map actua

What does the data-url attribute in jquery mobile do?

Trying to figure out the basic structure of a page and came across a blog that had the data-url attribute. What exactly does this mean?That attribute serves to identify pages that are auto-generated by jQM. From the jQM docs: ...Pages that are auto-g

How to keep node and npm up to date? (nodesource ppa)

I am using ubuntu 15.04. I recently installed nodejs through this ppa https://deb.nodesource.com/node_0.12 using the instructions found here: https://nodesource.com/blog/nodejs-v012-iojs-and-the-nodesource-linux-repositories npm came installed as par

What is the data structure of the Inode number?

I am flabbergasted by the definition of the inode number: An inode is a data structure on a traditional Unix-style file system such as UFS or ext3. An inode stores basic information about a regular file, directory, or other file system object. Source

What does the data type specification '9 (7) V9T' mean?

In some functional specs I'm reading they are talking about a numeric format with a 9(7)V9T presentation. -How do I interprete this kind of format notations? -How is this type physically stored in a flatfile (e.g. numeric?, signs? separators?) Thank

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK