*string = toupper(*string++)报错的原因在哪里
*string = toupper(*string++)出错的原因在哪里?
使用
使用
源文件如下:
------解决思路----------------------
看置顶帖
------解决思路----------------------
置顶贴有说明.http://bbs.****.net/topics/370153775
如果看不懂就, 就永远把自加自减单独写一行.
------解决思路----------------------
------解决思路----------------------
同意5L,在彻底掌握++之前,实践时只把++单独写一行。
使用
*string = toupper(*string++)无法执行大写转换操作。
使用
*string = toupper(*string);与之前的语句有什么区别?
string++;
源文件如下:
/*
*
*/
#include <stdio.h>
#include <string.h>
#include <ctype.h>
void toUpper(char *string);
void showString(const char *string);
int main(void)
{
char string[80] = "I love the C Programming.\n";
toUpper(string);
showString(string);
return 0;
}
void toUpper(char *string)
{
while('\0' != *string){
*string = toupper(*string);
string++;
}
}
void showString(const char *string)
{
while('\0' != *string)
putchar(*string++);
}
------解决思路----------------------
看置顶帖
------解决思路----------------------
置顶贴有说明.http://bbs.****.net/topics/370153775
如果看不懂就, 就永远把自加自减单独写一行.
------解决思路----------------------
//C++ Operators
// Operators specify an evaluation to be performed on one of the following:
// One operand (unary operator)
// Two operands (binary operator)
// Three operands (ternary operator)
// The C++ language includes all C operators and adds several new operators.
// Table 1.1 lists the operators available in Microsoft C++.
// Operators follow a strict precedence which defines the evaluation order of
//expressions containing these operators. Operators associate with either the
//expression on their left or the expression on their right; this is called
//“associativity.” Operators in the same group have equal precedence and are
//evaluated left to right in an expression unless explicitly forced by a pair of
//parentheses, ( ).
// Table 1.1 shows the precedence and associativity of C++ operators
// (from highest to lowest precedence).
//
//Table 1.1 C++ Operator Precedence and Associativity
// The highest precedence level is at the top of the table.
//+------------------+-----------------------------------------+---------------+
//
------解决思路----------------------
Operator
------解决思路----------------------
Name or Meaning
------解决思路----------------------
Associativity
------解决思路----------------------
//+------------------+-----------------------------------------+---------------+
//
------解决思路----------------------
::
------解决思路----------------------
Scope resolution
------解决思路----------------------
None
------解决思路----------------------
//
------解决思路----------------------
::
------解决思路----------------------
Global
------解决思路----------------------
None
------解决思路----------------------
//
------解决思路----------------------
[ ]
------解决思路----------------------
Array subscript
------解决思路----------------------
Left to right
------解决思路----------------------
//
------解决思路----------------------
( )
------解决思路----------------------
Function call
------解决思路----------------------
Left to right
------解决思路----------------------
//
------解决思路----------------------
( )
------解决思路----------------------
Conversion
------解决思路----------------------
None
------解决思路----------------------
//
------解决思路----------------------
.
------解决思路----------------------
Member selection (object)
------解决思路----------------------
Left to right
------解决思路----------------------
//
------解决思路----------------------
->
------解决思路----------------------
Member selection (pointer)
------解决思路----------------------
Left to right
------解决思路----------------------
//
------解决思路----------------------
++
------解决思路----------------------
Postfix increment
------解决思路----------------------
None
------解决思路----------------------
//
------解决思路----------------------
--
------解决思路----------------------
Postfix decrement
------解决思路----------------------
None
------解决思路----------------------
//
------解决思路----------------------
new
------解决思路----------------------
Allocate object
------解决思路----------------------
None
------解决思路----------------------
//
------解决思路----------------------
delete
------解决思路----------------------
Deallocate object
------解决思路----------------------
None
------解决思路----------------------
//
------解决思路----------------------
delete[ ]
------解决思路----------------------
Deallocate object
------解决思路----------------------
None
------解决思路----------------------
//
------解决思路----------------------
++
------解决思路----------------------
Prefix increment
------解决思路----------------------
None
------解决思路----------------------
//
------解决思路----------------------
--
------解决思路----------------------
Prefix decrement
------解决思路----------------------
None
------解决思路----------------------
//
------解决思路----------------------
*
------解决思路----------------------
Dereference
------解决思路----------------------
None
------解决思路----------------------
//
------解决思路----------------------
&
------解决思路----------------------
Address-of
------解决思路----------------------
None
------解决思路----------------------
//
------解决思路----------------------
+
------解决思路----------------------
Unary plus
------解决思路----------------------
None
------解决思路----------------------
//
------解决思路----------------------
-
------解决思路----------------------
Arithmetic negation (unary)
------解决思路----------------------
None
------解决思路----------------------
//
------解决思路----------------------
!
------解决思路----------------------
Logical NOT
------解决思路----------------------
None
------解决思路----------------------
//
------解决思路----------------------
~
------解决思路----------------------
Bitwise complement
------解决思路----------------------
None
------解决思路----------------------
//
------解决思路----------------------
sizeof
------解决思路----------------------
Size of object
------解决思路----------------------
None
------解决思路----------------------
//
------解决思路----------------------
sizeof ( )
------解决思路----------------------
Size of type
------解决思路----------------------
None
------解决思路----------------------
//
------解决思路----------------------
typeid( )
------解决思路----------------------
type name
------解决思路----------------------
None
------解决思路----------------------
//
------解决思路----------------------
(type)
------解决思路----------------------
Type cast (conversion)
------解决思路----------------------
Right to left
------解决思路----------------------
//
------解决思路----------------------
const_cast
------解决思路----------------------
Type cast (conversion)
------解决思路----------------------
None
------解决思路----------------------
//
------解决思路----------------------
dynamic_cast
------解决思路----------------------
Type cast (conversion)
------解决思路----------------------
None
------解决思路----------------------
//
------解决思路----------------------
reinterpret_cast
------解决思路----------------------
Type cast (conversion)
------解决思路----------------------
None
------解决思路----------------------
//
------解决思路----------------------
static_cast
------解决思路----------------------
Type cast (conversion)
------解决思路----------------------
None
------解决思路----------------------
//
------解决思路----------------------
.*
------解决思路----------------------
Apply pointer to class member (objects)
------解决思路----------------------
Left to right
------解决思路----------------------
//
------解决思路----------------------
->*
------解决思路----------------------
Dereference pointer to class member
------解决思路----------------------
Left to right
------解决思路----------------------
//
------解决思路----------------------
*
------解决思路----------------------
Multiplication
------解决思路----------------------
Left to right
------解决思路----------------------
//
------解决思路----------------------
/
------解决思路----------------------
Division
------解决思路----------------------
Left to right
------解决思路----------------------
//
------解决思路----------------------
%
------解决思路----------------------
Remainder (modulus)
------解决思路----------------------
Left to right
------解决思路----------------------
//
------解决思路----------------------
+
------解决思路----------------------
Addition
------解决思路----------------------
Left to right
------解决思路----------------------
//
------解决思路----------------------
-
------解决思路----------------------
Subtraction
------解决思路----------------------
Left to right
------解决思路----------------------
//
------解决思路----------------------
<<
------解决思路----------------------
Left shift
------解决思路----------------------
Left to right
------解决思路----------------------
//
------解决思路----------------------
>>
------解决思路----------------------
Right shift
------解决思路----------------------
Left to right
------解决思路----------------------
//
------解决思路----------------------
<
------解决思路----------------------
Less than
------解决思路----------------------
Left to right
------解决思路----------------------
//
------解决思路----------------------
>
------解决思路----------------------
Greater than
------解决思路----------------------
Left to right
------解决思路----------------------
//
------解决思路----------------------
<=
------解决思路----------------------
Less than or equal to
------解决思路----------------------
Left to right
------解决思路----------------------
//
------解决思路----------------------
>=
------解决思路----------------------
Greater than or equal to
------解决思路----------------------
Left to right
------解决思路----------------------
//
------解决思路----------------------
==
------解决思路----------------------
Equality
------解决思路----------------------
Left to right
------解决思路----------------------
//
------解决思路----------------------
!=
------解决思路----------------------
Inequality
------解决思路----------------------
Left to right
------解决思路----------------------
//
------解决思路----------------------
&
------解决思路----------------------
Bitwise AND
------解决思路----------------------
Left to right
------解决思路----------------------
//
------解决思路----------------------
^
------解决思路----------------------
Bitwise exclusive OR
------解决思路----------------------
Left to right
------解决思路----------------------
//
------解决思路----------------------
------解决思路----------------------
------解决思路----------------------
Bitwise OR
------解决思路----------------------
Left to right
------解决思路----------------------
//
------解决思路----------------------
&&
------解决思路----------------------
Logical AND
------解决思路----------------------
Left to right
------解决思路----------------------
//
------解决思路----------------------
------解决思路----------------------
------解决思路----------------------
Logical OR
------解决思路----------------------
Left to right
------解决思路----------------------
//
------解决思路----------------------
e1?e2:e3
------解决思路----------------------
Conditional
------解决思路----------------------
Right to left
------解决思路----------------------
//
------解决思路----------------------
=
------解决思路----------------------
Assignment
------解决思路----------------------
Right to left
------解决思路----------------------
//
------解决思路----------------------
*=
------解决思路----------------------
Multiplication assignment
------解决思路----------------------
Right to left
------解决思路----------------------
//
------解决思路----------------------
/=
------解决思路----------------------
Division assignment
------解决思路----------------------
Right to left
------解决思路----------------------
//
------解决思路----------------------
%=
------解决思路----------------------
Modulus assignment
------解决思路----------------------
Right to left
------解决思路----------------------
//
------解决思路----------------------
+=
------解决思路----------------------
Addition assignment
------解决思路----------------------
Right to left
------解决思路----------------------
//
------解决思路----------------------
-=
------解决思路----------------------
Subtraction assignment
------解决思路----------------------
Right to left
------解决思路----------------------
//
------解决思路----------------------
<<=
------解决思路----------------------
Left-shift assignment
------解决思路----------------------
Right to left
------解决思路----------------------
//
------解决思路----------------------
>>=
------解决思路----------------------
Right-shift assignment
------解决思路----------------------
Right to left
------解决思路----------------------
//
------解决思路----------------------
&=
------解决思路----------------------
Bitwise AND assignment
------解决思路----------------------
Right to left
------解决思路----------------------
//
------解决思路----------------------
------解决思路----------------------
=
------解决思路----------------------
Bitwise inclusive OR assignment
------解决思路----------------------
Right to left
------解决思路----------------------
//
------解决思路----------------------
^=
------解决思路----------------------
Bitwise exclusive OR assignment
------解决思路----------------------
Right to left
------解决思路----------------------
//
------解决思路----------------------
,
------解决思路----------------------
Comma
------解决思路----------------------
Left to right
------解决思路----------------------
//+------------------+-----------------------------------------+---------------+
------解决思路----------------------
同意5L,在彻底掌握++之前,实践时只把++单独写一行。