Which of the Following will define a type NODE that is a
node in a Linked list?
A)struct node {NODE*next;int x;};type def struct node NODE;
B)typedef struct NODE {struct NODE *next;int x;};
C)typedef struct NODE {NODE *next;int x;};
D)typedef struct {NODE *next;int x;}NODE;
Answers were Sorted based on User's Feedback
Answer / shahzad
B)
coz ..linked list node contain two parts ..
one is address to next node
other is data part in single list....
writting keyword struct before NODE is must..
| Is This Answer Correct ? | 4 Yes | 0 No |
Answer / gorgeousgirl
all the four given options throws error...
the correct answer should be:
typedef struct node NODE;
struct node {NODE*next;int x;};
| Is This Answer Correct ? | 4 Yes | 0 No |
Answer / ashwin kumar
Shahzad is correct
next node must be like a 1st node means it must have two
fields one for two store data and another field for
storing address of the next node.
in 2nd field where we have point to the next node we must
store address of the next node , so we are using pointer ,
as we are pointing to a next node of type structure so we
must use
struct NODE *next
plz info me if any mistake in my answer
molugu.ashwin@gmail.com
| Is This Answer Correct ? | 2 Yes | 0 No |
Answer / vikraman85
B is the answer..
b'coz in struct node *next only specify the address of the
next node.. others not..
| Is This Answer Correct ? | 3 Yes | 2 No |
how to write hello word without using semicolon at the end?
How do I swap bytes?
How many ways are there to swap two numbers without using temporary variable? Give the each logic.
Is it better to use a pointer to navigate an array of values, or is it better to use a subscripted array name?
How to declare a variable?
7-Given an index k, return the kth row of the Pascal's triangle. For example, when k = 3, the row is [1,3,3,1]. For reference look at the following standard pascal’s triangle.
Program to find the sum of digits of a given number until the sum becomes a single digit
WHAT IS HEADER?
What are dangling pointers? How are dangling pointers different from memory leaks?
write a function that accepts an array A with n elements and array B with n-1 elements. Find the missing one in array B,with an optimized manner?
how to create duplicate link list using C???
What are the basic data types associated with c?