Skip to content

Instantly share code, notes, and snippets.

View andreichernov's full-sized avatar

andreichernov andreichernov

View GitHub Profile
@andreichernov
andreichernov / PrintPositives
Created April 30, 2015 08:26
PrintPositives
void PrintPositives(int array[], int arraySize)
{
int i;
for (i = 0; i < arraySize; i++)
{
if (array[i] < 0) /* пропуск отрицательных элементов */
continue;
printf("%d ", array[i]);
}
}
@andreichernov
andreichernov / trim
Created April 30, 2015 07:21
trim: удаляет завершающие пробелы, табуляции и новые строки
/* trim: удаляет завершающие пробелы, табуляции и новые строки */
int trim(char s[])
{
int n;
for (n = strlen(s) - 1; n >= 0; --n)
{
if ((s[n] != ' ') && (s[n] != '\t') && (s[n] != '\n'))
break; // выходим из цикла, встретив печатаемый символ
}
s[n+1] = '\0';
@andreichernov
andreichernov / 0_reuse_code.js
Last active August 29, 2015 14:19
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console