int main()
{
printf("%d%d", SetConsoleCP(1251), SetConsoleOutputCP(1251));
startend(1);
_getch();
char **ptr = NULL;
short n = 0;
ptr = (char**)malloc(sizeof(*ptr)*3);
ptr[0] = (char*)malloc(sizeof(char)*50);
ptr[1] = (char*)malloc(sizeof(char)*50);
ptr[2] = (char*)malloc(sizeof(char)*50);
for (int i = 0; i < 50; i++)
{
ptr[0][i] = ' ';
ptr[1][i] = ' ';
ptr[2][i] = ' ';
}
ptr[0][49] = '\0';
ptr[1][49] = '\0';
ptr[2][49] = '\0';
ptr[0] = "1001.01\0";
ptr[1] = "11.1\0";
n = 2;
printf("%s\n", ml(ptr[0], ptr[1], n, ptr[2]));
printf("1");
free(ptr[0]);
printf("2");
free(ptr[1]);
printf("3");
free(ptr[2]);
printf("4");
free(ptr);
printf("5");
ptr = NULL;
printf("6");
startend(0);
return 0;
}
char * ml(char *a, char *b, short n, char *res)
{
long alen = 0 - (a - strchr(a, '\0'));
long blen = 0 - (b - strchr(b, '\0'));
long da = 0, db = 0, dr = 0;
if (strchr(a, '.') != NULL)
{
da = alen - (1 - (a - strchr(a, '.')));
for (long dd = alen - da - 1; dd < alen; dd++)
a[dd] = a[dd + 1];//прерывается здесь
alen -= 1;
}
if (strchr(b, '.') != NULL)
{
db = blen - (1 - (b - strchr(b, '.')));
for (long dd = blen - db - 1; dd < blen; dd++)
b[dd] = b[dd + 1];
blen -= 1;
}
dr = da + db;
for (long l = 0; l < alen + 1 + blen; l++)
res[l] = '0';
res[alen + 1 + blen] = '\0';
char *ptr = malloc(sizeof(char) * (alen + 1));
...
#include <stdio.h>
#include <windows.h>
#include <conio.h>
#include <stdlib.h>
#include "arifmethicforn.h"
void startend(int status);
int main()
{
printf("%d%d", SetConsoleCP(1251), SetConsoleOutputCP(1251));
startend(1);
_getch();
char **ptr = NULL;
short n = 0;
ptr = (char**)malloc(3);
ptr[0] = (char*)malloc(50);
ptr[1] = (char*)malloc(50);
ptr[2] = (char*)malloc(50);
for (int i = 0; i < 50; i++)
{
ptr[0][i] = ' ';
ptr[1][i] = ' ';
ptr[2][i] = ' ';
}
ptr[0][49] = '\0';
ptr[1][49] = '\0';
ptr[2][49] = '\0';
ptr[0] = "1001.01\0";
ptr[1] = "11.1\0";
n = 2;
printf("%s\n", ml(ptr[0], ptr[1], n, ptr[2]));
printf("1");
free(ptr[0]);
printf("2");
free(ptr[1]);
printf("3");
free(ptr[2]);
printf("4");
free(ptr);
printf("5");
ptr = NULL;
printf("6");
startend(0);
return 0;
}
void startend(int status)
{
if (status == 1)
printf("__________________________________________________________________________\n\t\t\tВведите символ для старта...\n----------------------------------------------------------------------------\n");
else
printf("\n____________________________________________________________________________\n\t\t\tВведите символ для выхода...\n----------------------------------------------------------------------------\n");
_getch();
printf("____________________________________________________________________________\n\n\n");
}
подскажите пж как вызвать, а уж в обратном порядке я реверсом воспользуюсь