6.
.
.
- , .
, - . - . , , .
int *countPtr, count;
countPtr, int * (.. ) countPtr countPtr int.
count , . * countPtr. , , (*).
,
float *xPtr, *yPtr;
, xPtr yPtr float.
Ptr .
count 7.
countPtr count
count 7.
0, NULL .
.
& , . ,
int y = 5;
int * yPtr;
yPtr = &y;
y, yPtr.
y
yPtr
, .
yPtr y
500 600
, , y 600, yPtr 500.
* . , (.. ).
,
cout << * yPtr << endl;
y, .. 5. * .
.
3 :
,
,
.
, return ( - ).
, ( , ), .
|
|
, , , ( ).
, , . (&) , .
&, , .
(*) . , const.
.5.6 .5.7
// .5.6
//
//
#include "stdafx.h"
#include <iostream>
using namespace std;
int cube (int); //
int _tmain(int argc, _TCHAR* argv[])
{setlocale(LC_ALL, "rus");
int number=5;
cout<<" : "<<number<<endl;
number=cube(number);
cout<<" : "<<number<<endl;
return 0;
}
int cube (int n)
{
return n*n*n; // n
}
// .5.7
//
//
#include "stdafx.h"
#include <iostream>
using namespace std;
void cube1 (int *); //
int _tmain(int argc, _TCHAR* argv[])
{setlocale(LC_ALL, "rus");
int number=5;
cout<<" : "<<number<<endl;
cube1(&number);
cout<<" : "<<number<<endl;
return 0;
}
void cube1 (int *nPtr)
{
*nPtr=*nPtr**nPtr**nPtr; // main
}
.
char *strcpy (char *s1, const char *s2) s2 s1. s1. , , .
char *strncpy (char *s1, const char *s2, size_t n) n s2 s1. s1.
char *strcat (char *s1, const char *s2) s2 s1. s2 s1. s1. , , s1, , s1 s2.
char * strncat (char *s1, const char *s2, size_t n) n s2 s1. s2 s1. s1.
int strcmp (const char *s1, const char *s2) s1 s2. 0, , 0 , 0, s1 , , s2.
|
|
int strncmp (const char *s1, const char *s2, size_t n) n s1 s2. 0, , 0 , 0, s1 , , s2.
char strtok (char *s1, const char *s2) strtok s1 - , , , s2. s1, , NULL. . , NULL.
size_t strlen (const char *s) s. , .