|
You are welcome
Regards.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
The problem basically is that you're not initializing the local variables.
Uninitialized local variables are said to have undefined values.
The undefined values are those that you see in the watch window.
|
|
|
|
|
We define the structure for a linked list as given below.
What i know that the structure of a linked list consists of two parts i.e. value and the pointer to another variable.
Considering this the value should be of integer type (which it definitely is) but the address pointer should be just an integer pointer (according to my view.).
Now why address pointer is defined as a structure and of the same name as of the list????
struct list {
int val;
struct list * next;
};
|
|
|
|
|
Because the list is a list of structures that contain data. In your case, the data is just a simple int. Generally, the data will be more complex.
You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists.
|
|
|
|
|
If you just do the next a pointer to a int* then you won't be able to have more elements, you are going to miss the "next" pointer on the following item.
In other words...
struct list {
int val;
struct list * next;
};
allows you to have a lot of items connected with "next"
struct list {
int val;
int* next;
};
Here you have ONLY one item, with two elements, an integer and a pointer to an integer.
Think about... what would happen if you add more elements to your item? you could have, for instance...
struct list {
int iVal;
double dFactor;
char cType;
struct list * next;
};
Which pointer would you need to go to the next item in your list? int*? char*? double*?
That's the reason why you need to use struct list* next .
Regards.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
Thanks a lot. Your reply cleared my unclear concepts effectively.
|
|
|
|
|
You are welcome
Regards.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
Hi,
you managed to confuse yourself by picking bad names; here is basically the same code:
struct node {
int val;
struct node * next;
};
but now the struct is called "node", since it holds one node, i.e. one item that could be part of a linked list; and in such list each node, except the last one, points to the next node.
|
|
|
|
|
.
Merry Christmas, everyone!
Do functions MakeUpper() and MakeLower() of CString work well for Non-English languages, such as French, German, Greek, Japanese, Korean etc?
I don't know if the languages specified above are case-sensitive, my question is:
Can MakeUpper() and MakeLower() change case for Non-English characters if they are case-sensitive?
|
|
|
|
|
I would expect them to work well with European languages based on the Roman, Greek, and Cyrillic alphabets. Asian languages are another story. Japanese has three character sets; Kanji (Chinese), Hiragana, and Katakana. Kanji is not an alphabet and as such has no capitalization. Hiragan and Katakana are phoentic character sets where each character represents a syallable. They also have no capital forms. I really don't know about Middle Eastern languages.
You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists.
|
|
|
|
|
Hi, thanks, you look like a language expert.
"I would expect:"
Yes for following languages:
French
German
Greek
Latin
No for:
Japanese
Korean
How about followings?
Italian
Russian
Portuguese
Spanish
Is this your opinion?
Could you write down a list as above, so it is clearer?
Could you also add more main languages as you know?
|
|
|
|
|
Tim Craig wrote: "I would expect them to work well with European languages based on the Roman, Greek, and Cyrillic alphabets"
includeh10 wrote: "How about followings?
Italian
Russian
Portuguese
Spanish
"
Cyrillic is for Russia and many of the North-Middle East-Europe lands.
The rest are include in Roman alphabet. Same as Flamingo, Holandish...
North Europe (Finland, Norway and other scandinavian countries), Turkey, Poland and some others are based in roman alphabet, but they have some special characters (specially vocals), but in my opinion they should accept the case sensitive as well.
Regards.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
Last time I try to help you, jerk.
You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists.
|
|
|
|
|
Tim Craig wrote: Last time I try to help you, jerk.
I could be wrong, but I don't think he meant to offend you.
L u n a t i c F r i n g e
|
|
|
|
|
Sounded mocking to me and then he seemed to demand more. Seemed in tune with his past performance here.
You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists.
|
|
|
|
|
Unfamiliar with the past performance.
BTW, it wasn't me that gave you a negative vote. Didn't think that was really warranted.
L u n a t i c F r i n g e
|
|
|
|
|
He's been called on his behavior here a number of times in the past by the regulars. He seems to think people are here just to serve his pleasure. I had already started to write the reply to his question when I realized it was him and nearly deleted it, the original question that is. I stand by my smackdown and if the 1 votes come, so be it.
You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists.
|
|
|
|
|
You'd be better served asking about _wcsupr_s() and _wcslwr_s() .
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Though I mainly code in pure winapi, I hope you have some unicode fucntion for same proably something like MakeUpperW() and MakeLowerW(). Actually if you add 65 to a uppercase letter it becomes lower case letter or subtract 65, it becomes the opposite.
|
|
|
|
|
As follows:
int arr[], brr[];
arr = brr;
so, how to do that assign one array to another?
|
|
|
|
|
|
That may not accomplish what he wants. If he's making a temporary copy to use as a scratch pad in a calculation and wants to preserve the original, it certainly won't. Your example just provides a different way to access the same data, not a copy.
You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists.
|
|
|
|
|
For copying arrays, you can use functions like memcpy_s[^] and CopyMemory[^].
These functions require you to know the size of the array.
In C++, ideally you should be using the STL containers like vector , list etc. and then you can use the copy[^] function to make a copy of a container using iterators as shown in the example in the documentation.
|
|
|
|
|
In the following code when we print the list why do we do curr = curr->next ;
#include<stdlib.h>
#include<stdio.h>
struct list_el {
int val;
struct list_el * next;
};
typedef struct list_el item;
int main() {
item * curr, * head;
int i;
head = NULL;
for(i=1;i<=3;i++) {
curr = (item *)malloc(sizeof(item));
curr->val = i;
curr->next = head;
head = curr;
}
curr = head;
while(curr) {
printf("%d\n", curr->val);
curr = curr->next ;
}
}
|
|
|
|
|
Razanust wrote: why do we do curr = curr->next ;
to get to the next item in the list... ?
|
|
|
|