473,385 Members | 1,752 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

hi friends

I am learning datastructure using c in my syllabus and i want to learn
about datastructure, c++, java, oracle, web design, html,c#.
SO I AM REQUESTING YOU THAT PLEASE SEND ME SOME INFORMATION
ABOUT THE ABOVE MENTIONED TOPICS.

AND ALSO SEND ME SOME INFORMATION ABOUT INTERNET.

YOURS FAITHFULLY
KIRAN.M.K

Jun 27 '06 #1
16 2427
appi wrote:
AND ALSO SEND ME SOME INFORMATION ABOUT INTERNET.


Shouting on Usenet does not get you friends.

--
Chris "hush" Dollin
"People are part of the design. It's dangerous to forget that." /Star Cops/

Jun 27 '06 #2

appi wrote:
I am learning datastructure using c in my syllabus and i want to learn
about datastructure, c++, java, oracle, web design, html,c#.
SO I AM REQUESTING YOU THAT PLEASE SEND ME SOME INFORMATION
ABOUT THE ABOVE MENTIONED TOPICS.

AND ALSO SEND ME SOME INFORMATION ABOUT INTERNET.

YOURS FAITHFULLY
KIRAN.M.K


Internet lesson 1: SHOUTING AT PEOPLE IS VERY VERY RUDE!

Usenet lesson 1: comp.lang.c deals with C not any of the other stuff
you mention.

c.l.c lesson 1:
<http://www.clc-wiki.net/wiki/Introduction_to_comp.lang.c>

Good luck!

Jun 27 '06 #3
appi said:
I am learning datastructure using c in my syllabus and i want to learn
about datastructure, c++, java, oracle, web design, html,c#.
SO I AM REQUESTING YOU THAT PLEASE SEND ME SOME INFORMATION
ABOUT THE ABOVE MENTIONED TOPICS.

AND ALSO SEND ME SOME INFORMATION ABOUT INTERNET.

YOURS FAITHFULLY
KIRAN.M.K


#include <stdio.h>
#include <ctype.h>

int main(void)
{
int ch;
while((ch = getchar()) != EOF)
{
putchar(tolower((unsigned char)ch));
}

return 0;
}

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
Jun 27 '06 #4
Richard Heathfield wrote:
appi said:
I am learning datastructure using c in my syllabus and i want to learn
about datastructure, c++, java, oracle, web design, html,c#.
SO I AM REQUESTING YOU THAT PLEASE SEND ME SOME INFORMATION
ABOUT THE ABOVE MENTIONED TOPICS.

AND ALSO SEND ME SOME INFORMATION ABOUT INTERNET.

YOURS FAITHFULLY
KIRAN.M.K


#include <stdio.h>
#include <ctype.h>

int main(void)
{
int ch;
while((ch = getchar()) != EOF)
{
putchar(tolower((unsigned char)ch));

<snip>

What is the cast supposed to accomplish here? If I've understood the
standard correctly, nothing.

Is it supposed to accomplish something in general? If 'ch' were not
representable as an unsigned char, you avoid undefined behavior with an
explicit conversion, but since the end result is still indeterminate to a
portable program, this doesn't seem like a big win (it's a small win, since
you at least know your program will output gibberish at the worst, rather
than launch the nuclear missiles, but still).

If invalid values are expected, the program should handle their occurrence
explicitly. If the most appropriate explicit handling turns out to be
converting the values explicitly and hoping for the best, then that's fine,
but I wouldn't insert that reflexively.

S.
Jun 27 '06 #5
Skarmander wrote:

Richard Heathfield wrote:
putchar(tolower((unsigned char)ch));

What is the cast supposed to accomplish here? If I've understood the
standard correctly, nothing.

Is it supposed to accomplish something in general?


Yes.
If ch is a negative value,
and if ((unsigned char)ch) compares equal to 'A',
then putchar(ch) will output 'A'.

--
pete
Jun 27 '06 #6
pete wrote:
Skarmander wrote:
Richard Heathfield wrote:

putchar(tolower((unsigned char)ch));

What is the cast supposed to accomplish here? If I've understood the
standard correctly, nothing.

Is it supposed to accomplish something in general?


Yes.
If ch is a negative value,
and if ((unsigned char)ch) compares equal to 'A',
then putchar(ch) will output 'A'.

But why would this be useful? How would you obtain such values, and why
would you use them?

S.
Jun 27 '06 #7
Skarmander wrote:

pete wrote:
Skarmander wrote:
Richard Heathfield wrote:

putchar(tolower((unsigned char)ch));

What is the cast supposed to accomplish here?
If I've understood the
standard correctly, nothing.

Is it supposed to accomplish something in general?


Yes.
If ch is a negative value,
and if ((unsigned char)ch) compares equal to 'A',
then putchar(ch) will output 'A'.

But why would this be useful?
How would you obtain such values, and why
would you use them?


In the C locale,
which is what the program in question was,
I don't think it matters.

But I took your phrase "in general"
to imply "regardless of locale".

N869
7.4 Character handling <ctype.h>

[#2] The behavior of these functions is affected by the
current locale.

--
pete
Jun 27 '06 #8
pete wrote:
Skarmander wrote:
pete wrote:
Skarmander wrote:
Richard Heathfield wrote:
> putchar(tolower((unsigned char)ch));
What is the cast supposed to accomplish here?
If I've understood the
standard correctly, nothing.

Is it supposed to accomplish something in general?
Yes.
If ch is a negative value,
and if ((unsigned char)ch) compares equal to 'A',
then putchar(ch) will output 'A'.

But why would this be useful?
How would you obtain such values, and why
would you use them?


In the C locale,
which is what the program in question was,
I don't think it matters.

But I took your phrase "in general"
to imply "regardless of locale".

N869
7.4 Character handling <ctype.h>

[#2] The behavior of these functions is affected by the
current locale.

"Regardless of locale" just means the program can't assume a particular
locale to be in effect.

I didn't mean to ask if there was some possibility that the statement
putchar(tolower((unsigned char) ch));
occurring in some program, using some locale, has a reason for the cast to
be there. Of course there will be such programs and locales. The question is
whether there's any other interpretation of that cast *in general* than a
slightly questionable attempt at error handling.

Either the value you're working with is expected, or it isn't. If it isn't,
converting makes little sense (except to convert potentially undefined
behavior into potentially gibberish output, which may have some extrinsic
value). If it is, converting makes sense only for some particular algorithm
in combination with some particular locales, which was not the context I was
talking about.

S.
Jun 27 '06 #9
appi wrote:
I am learning datastructure using c in my syllabus and i want to learn
about datastructure, c++, java, oracle, web design, html,c#.
Are all of the above included in your syllabus!?

Try to learn one langauge at a time. It's better to know one or two
langauges really well than hack around with several langauges. I
suggest you learn C, SQL and HTML to start with. I personally favour
Python instead of Java or C++, but YMMV.
SO I AM REQUESTING YOU THAT PLEASE SEND ME SOME INFORMATION
ABOUT THE ABOVE MENTIONED TOPICS.
Firstly, using all caps is considered as shouting. We've left Yahoo!
Chat; we're in Usenet.
Also this group deals with standard C and not general programming. You
might want to post to comp.programming, *but*, before you do that, be
sure to read the information at the following URLs.

<http://cfaj.freeshell.org/google/>
<http://clc-wiki.net/wiki/Introduction_to_comp.lang.c>
<http://www.safalra.com/special/googlegroupsreply/>
<http://en.wikipedia.org/wiki/USENET>
<http://en.wikipedia.org/wiki/Netiquette>
AND ALSO SEND ME SOME INFORMATION ABOUT INTERNET.

I assume you know how to use Google... ?

Jun 27 '06 #10
Richard Heathfield wrote:
appi said:
I am learning datastructure using c in my syllabus and i want to learn
about datastructure, c++, java, oracle, web design, html,c#.
SO I AM REQUESTING YOU THAT PLEASE SEND ME SOME INFORMATION
ABOUT THE ABOVE MENTIONED TOPICS. #include <stdio.h>
#include <ctype.h>

int main(void)
{
int ch;
while((ch = getchar()) != EOF)
{
putchar(tolower((unsigned char)ch));


Is the cast here necessary?
}

return 0;
}


Jun 27 '06 #11
Skarmander said:
Richard Heathfield wrote:
appi said:
I am learning datastructure using c in my syllabus and i want to learn
about datastructure, c++, java, oracle, web design, html,c#.
SO I AM REQUESTING YOU THAT PLEASE SEND ME SOME INFORMATION
ABOUT THE ABOVE MENTIONED TOPICS.

AND ALSO SEND ME SOME INFORMATION ABOUT INTERNET.

YOURS FAITHFULLY
KIRAN.M.K
#include <stdio.h>
#include <ctype.h>

int main(void)
{
int ch;
while((ch = getchar()) != EOF)
{
putchar(tolower((unsigned char)ch));

<snip>

What is the cast supposed to accomplish here? If I've understood the
standard correctly, nothing.


Since getchar returns an unsigned char converted to int, you're right in
this case. I was over-egging.
Is it supposed to accomplish something in general?


Yes. Consider the following code:

#include <stdio.h>
#define MAXLINE 1024
int main(void)
{
char line[MAXLINE];
while(fgets(line, sizeof line, stdin) != NULL)
{
size_t i;
for i = 0; line[i] != '\0'; i++)
{
putchar(tolower(line[i])); /* BUG - see below */
}
}
return 0;
}

Consider a user who manages to input "special characters" (e.g. in MS-DOS,
he types Alt-0156 to get a UKP sign), that are not in the range 0 to
UCHAR_MAX. fgets will capture these correctly, as unsigned chars, but then
assign them into members of the line array, which are chars. If we continue
with our MS-DOS example, the char value will be *negative*. When this value
is passed to tolower(), it will be promoted to int, but it will still be
negative. So if tolower() is implemented as an array lookup (which is
perfectly legal), the offset into that array will be negative for this
character. Bang, as they say. Converting the character to unsigned char
explicitly, on the other hand, means that everything comes out in the wash
and the character is handled correctly.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
Jun 27 '06 #12
santosh said:
Richard Heathfield wrote:

<snip>

int main(void)
{
int ch;
while((ch = getchar()) != EOF)
{
putchar(tolower((unsigned char)ch));


Is the cast here necessary?


It's one of those times when a habit that /can/ save your bacon /doesn't/
save your bacon because, in this exact circumstance, your bacon is not
endangered. That doesn't mean it's a mistake to have developed the habit.
--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
Jun 27 '06 #13
Richard Heathfield wrote:
Skarmander said:
Richard Heathfield wrote: <snip>
#include <stdio.h>
#include <ctype.h>

int main(void)
{
int ch;
while((ch = getchar()) != EOF)
{
putchar(tolower((unsigned char)ch));

<snip>

What is the cast supposed to accomplish here? If I've understood the
standard correctly, nothing.


Since getchar returns an unsigned char converted to int, you're right in
this case. I was over-egging.
Is it supposed to accomplish something in general?


Yes. Consider the following code:

#include <stdio.h>
#define MAXLINE 1024
int main(void)
{
char line[MAXLINE];
while(fgets(line, sizeof line, stdin) != NULL)
{
size_t i;
for i = 0; line[i] != '\0'; i++)
{
putchar(tolower(line[i])); /* BUG - see below */
}
}
return 0;
}

Consider a user who manages to input "special characters" (e.g. in MS-DOS,
he types Alt-0156 to get a UKP sign), that are not in the range 0 to
UCHAR_MAX. fgets will capture these correctly, as unsigned chars, but then
assign them into members of the line array, which are chars. If we continue
with our MS-DOS example, the char value will be *negative*.


Thanks, this is what I was looking for. The problem is not that "invalid"
characters are read, but that 'char' may be signed, whereas the various
character functions expect an unsigned char converted to int.

That's a neat gotcha.

S.
Jun 27 '06 #14
"appi" <co***********@gmail.com> writes:
I am learning datastructure using c in my syllabus and i want to learn
about datastructure, c++, java, oracle, web design, html,c#.
SO I AM REQUESTING YOU THAT PLEASE SEND ME SOME INFORMATION
ABOUT THE ABOVE MENTIONED TOPICS.

AND ALSO SEND ME SOME INFORMATION ABOUT INTERNET.

YOURS FAITHFULLY
KIRAN.M.K


<HTTP://WWW.CATB.ORG/~ESR/FAQS/SMART-QUESTIONS.HTML>

Oops, sorry, I meant

<http://www.catb.org/~esr/faqs/smart-questions.html>

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Jun 27 '06 #15
In article <ln************@nuthaus.mib.org>, Keith Thompson <kst-
u@mib.org> writes
"appi" <co***********@gmail.com> writes:
I am learning datastructure using c in my syllabus and i want to learn
about datastructure, c++, java, oracle, web design, html,c#.
SO I AM REQUESTING YOU THAT PLEASE SEND ME SOME INFORMATION
ABOUT THE ABOVE MENTIONED TOPICS.

AND ALSO SEND ME SOME INFORMATION ABOUT INTERNET.

YOURS FAITHFULLY
KIRAN.M.K


<HTTP://WWW.CATB.ORG/~ESR/FAQS/SMART-QUESTIONS.HTML>

Oops, sorry, I meant

<http://www.catb.org/~esr/faqs/smart-questions.html>


I heard you the first time :-)

We could of course actually do what he asks for the next 30 days, send
*ALL* the information you have on datastructures, C++ etc etc to his
email address....

How many Gb does a Gmail account hold?
Be careful what you wish for :-)

--
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
\/\/\/\/\ Chris Hills Staffs England /\/\/\/\/
/\/\/ ch***@phaedsys.org www.phaedsys.org \/\/\
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/

Jun 28 '06 #16
Richard Heathfield wrote:
santosh said:

Richard Heathfield wrote:


<snip>
int main(void)
{
int ch;
while((ch = getchar()) != EOF)
{
putchar(tolower((unsigned char)ch));


Is the cast here necessary?

It's one of those times when a habit that /can/ save your bacon /doesn't/
save your bacon because, in this exact circumstance, your bacon is not
endangered. That doesn't mean it's a mistake to have developed the habit.


Mmmm... bacon.

Joe
Jun 29 '06 #17

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Sean Don | last post by:
Hello! Is it possible to make classes friends in Python? Or is it better to just stick to "Java style" .isThis, .getThat, .setThis style functions? I understand that classes are generally...
4
by: jr | last post by:
I'm currently using the msnp.py code from Manish Jethani's project. I havn't been able to get the friends list to update like it should. it works once out of about every 25 times the program loads....
11
by: Micha | last post by:
Hello there, I think I've run into some classic c++ pitfall and maybe some of you guys can help me out. For my project I will need to use matrices and vectors and so I decided to implement them...
6
by: (Pete Cresswell) | last post by:
I'm makeing a little DB to help manage high school class reunions. One feature I'm trying to implement is "Friends". e.g. Fred Smith is a friend of Joe Jones and Bill Anderson. We record...
11
by: zhangzhan | last post by:
hello.everyone,i am an chinese.i study in shanxi unniversity,as i like english very much,i also wanr to make friends with a foriger. .....i really don't kown what i should to say ,as i first came...
0
by: goosen_cug | last post by:
hello.everyone,i am an chinese.i study in China University of Geosiences,as i like english and C++(program) very much,i also want to make friends with a foriger to improve my english and the...
1
by: goosen_cug | last post by:
hello.everyone,i am an chinese.i study in China University of Geosiences,as i like english and C++(program) very much,i also want to make friends with a foriger to improve my english and the...
3
by: shaun roe | last post by:
Hello, I am working in a framework with certain restrictions; in particular I have a 'data' class with getter and setter methods, and a some 'filling' classes which know how to insert the data to...
1
by: KittenKoder | last post by:
Basically I'm trying to parse my friends page on MySpace. It's easy to get Page 1. I can use "MSXML2.ServerXMLHTTP" to get the page and parse all my friends. The question is, how do I get page 2...
2
by: LeXave | last post by:
Hi all I've got the following problem in my database structure : I have a table "User". Each user can have one or more friends which are users too. And I have no idea about the way I must think...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.