Так вот, стоит ли мне зацикливаться сейчас на этом и правда ли то, что если я не пойму этого сейчас, то никогда не пойму?
Не понимаю, что именно генерирует функция rand()
не понимаю зачем использовать остаток от деления
У нас есть две вспомогательных структуры это структура хранящая первый элемент списка (для того, чтобы знать с чего начинать) и структура для хранения последнего элемента (не совсем понимаю для чего).
void mystrcpy(char *to, char *from)
{
    while((*to++ = *from++))
        ;
}#include <iostream>
#include <cstdio>
using namespace std;
void mystrcpy(char *to, char *from);
int main()
{
    char str1[20], str2[20];
    cout << "enter string: ";
    gets(str1);
    mystrcpy(str2, str1);
    cout << "string copiet: " << str2;
    cin.get();
    return 0;
}
void mystrcpy(char *to, char *from)
{
    while((*to++ = *from++))
        ;
}#include <iostream>
using namespace std;
int main()
{
    double **p = 0;
    p = new double *;
    int size;
    cout << "Input size: ";
    cin >> size;
    *p = new double[size];
    for (int i = 0; i < size; i++)
        *(*p + i) = 0;
    **p = *(*p + size - 1) = 2;
    cout << "size: " << size << endl;
    for (int i = 0; i < size; i++)
        cout << *(*p + i) << " ";
    cout << endl;
    delete [] *p;
    delete p;
    p = 0;
    return 0;
}[guest@localhost cpp]$ .iso++ t.cpp -o t
[guest@localhost cpp]$ ./t
Input size: 10
size: 10
2 0 0 0 0 0 0 0 0 2 
[guest@localhost cpp]$Как это решается в серьезных проектах ?
Раньше просто писал
cin.get()
cin.get()
достало
system(“pause”)
getch()
тоже костыли !
#include <stdio.h>
struct a {
    int a, b, c;
};
struct b {
    double a, b, c, d;
};
struct c {
    char s[100];
};
struct d {
    int a, b, c;
    double n[10];
};
union x {
    struct a a;
    struct b b;
    struct c c;
    struct d d;    
};
typedef struct {
    enum { A, B, C, D } type;
    union x value;
} Obj;
int main(void)
{
    Obj objects[100], *pobj;
    int n;
    int i;
    objects[0].type = A;
    objects[0].value.a.a = 1;
    objects[0].value.a.b = 2;
    objects[0].value.a.c = 3;
    objects[1].type = B;
    objects[1].value.b.a = 1.5;
    objects[1].value.b.b = 2.5;
    objects[1].value.b.c = 3.5;
    objects[1].value.b.d = 4.5;
    objects[2].type = C;
    sprintf(objects[2].value.c.s, "abc");
    objects[3].type = A;
    objects[3].value.a.a = 4;
    objects[3].value.a.b = 5;
    objects[3].value.a.c = 6;
    n = 4;
    
    for (i = 0; i < n; i++) {
        pobj = objects + i;
        switch (pobj->type) {
        case A:
            printf("A: %d %d %d\n",
                   pobj->value.a.a,
                   pobj->value.a.b,
                   pobj->value.a.c);
            break;
        case B:
            printf("B: %g %g %g %g\n",
                   pobj->value.b.a,
                   pobj->value.b.b,
                   pobj->value.b.c,
                   pobj->value.b.d);
            break;
        case C:
            printf("C: %s\n", pobj->value.c.s);
            break;
        case D:
            printf("D: %g\n", pobj->value.d.n[0]);
            break;
        }
    }
    return 0;
}[guest@localhost c]$ .ansi t.c -o t
[guest@localhost c]$ ./t
A: 1 2 3
B: 1.5 2.5 3.5 4.5
C: abc
A: 4 5 6
[guest@localhost c]$if (cond)
    ;
else
    statement;if (cond) {}
else {
    statement;
}if (cond)
    if (cond)
        if (cond) {
            statement;
        statement;
        }
    else
        statement;
else
    statement;if (cond) {
    if (cond) {
        if (cond) {
            statement;
        statement;
        }
    else {
        statement;
    }
}
else {
    statement;
}
}Или хотя бы расскажите, что он делает.
#include <stdio.h>
int main(void)
{
    enum { A, B, C };
    {
        enum { A = 10 };
        printf("%d\n", A);
    }
    printf("%d %d %d\n", A, B, C);
    return 0;
}[guest@localhost c]$ .ansi t.c -o t
[guest@localhost c]$ ./t
10
0 1 2
[guest@localhost c]$man stat.hThe  following  symbolic names for the values of type mode_t shall also
be defined.
File type:
S_IFMT Type of file.
S_IFBLK
       Block special.
S_IFCHR
       Character special.
S_IFIFO
       FIFO special.
S_IFREG
       Regular.
S_IFDIR
       Directory.
...
The following macros shall be provided to test whether a file is of the
specified  type.  The  value  m  supplied to the macros is the value of
st_mode from a stat structure.  The macro shall evaluate to a  non-zero
value if the test is true; 0 if the test is false.
S_ISBLK(m)
       Test for a block special file.
S_ISCHR(m)
       Test for a character special file.
S_ISDIR(m)
       Test for a directory.
S_ISFIFO(m)
       Test for a pipe or FIFO special file.
S_ISREG(m)
       Test for a regular file.
S_ISLNK(m)
       Test for a symbolic link.
S_ISSOCK(m)
       Test for a socket.