View difference between Paste ID: RmpfmE93 and 6j7ZRbnh
SHOW: | | - or go back to the newest paste.
1
#define _CRT_SECURE_NO_WARNINGS
2
#include <stdio.h>
3
#include <stdlib.h>
4
#include <math.h>
5-
#define N 80//delete
5+
6
7-
int  decrypt(char[]);
7+
char* decrypt(char[]);
8
9
void main()
10
{
11
	int r;
12
	char *s, crypto[] ="Btwlzx Dqqes Eq|pj2 Tjhvqujs Iqoqjy bpg Eqfxtx Xcwwtt";
13
	s = decrypt(crypto);
14-
	for (r = 0; r < 60;r++)//delete
14+
	//ככה מדפיסים
15-
	printf("%c", s);//delete
15+
	printf("%s\n",s);
16
}
17
18
19-
int decrypt(char crypto[])
19+
char* decrypt(char crypto[])
20
{
21-
	char new_string[N] = "0";
21+
	char *new_string;
22
	char c;
23
	int g, i=0,j=0, count_of_crypto=0,pl=0;
24
	for (crypto[i]; crypto[i] != '\0' ; i++)
25
		count_of_crypto++;
26-
	*new_string = (char *)malloc(count_of_crypto * (sizeof(char)));
26+
	new_string = (char *)malloc(count_of_crypto * (sizeof(char)));
27-
	//while (crypto != '\0')
27+
28
	{
29
		c = crypto[pl];
30
		if (c == 32)
31
		{
32
33
			new_string[pl] = ' ';
34
			j=0;
35
			c = crypto[pl+1];
36
			pl++;
37
		}
38
		new_string[pl] = c - (j+1);
39
		pl++;
40
		j++;
41
	}
42
	*(new_string + count_of_crypto) = '\0';
43-
	return &new_string;
43+
	return new_string;
44
45
}