473,320 Members | 2,054 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,320 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 2418
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: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.