What do you want to save?
Add Code snippet
New code examples
-
Other 2021-11-19 13:00:07
implement crc using c language
#include <stdio.h> #include <conio.h> #include <string.h> void main() { int i,j,keylen,msglen; char input[100], key[30],temp[30],quot[100],rem[30],key1[30]; clrscr(); printf("Enter Data: "); gets(input); printf("Enter Key:... Add solution -
Other 2021-11-18 04:25:18
Write a program to check whether inputted string is palindrome or not.
#include <stdio.h> #include <string.h> int main() { char s[1000]; int i,n,c=0; printf("Enter the string : "); gets(s); n=strlen(s); for(i=0;i<n/2;i++) { if(s[i]==s[n-i-1]) c++; ... Add solution -
C++ 2021-11-17 09:41:13
cpp program to temove space from string
#include<iostream> #include<string.h> using namespace std; int main () { char str[80]; int i=0, len, j; cout << "Enter a string : "; gets(str); len = strlen(str); for( i = 0; i < len; i++) { ... Add solution -
Other 2021-11-14 21:53:13
Destuctors delete new pointers in claa
// spec1_destructors.cpp #include <string> class String { public: String( char *ch ); // Declare constructor ~String(); // and destructor. private: char *_text; size_t sizeOfText; }; // Define the constructor. String::S... Add solution -
C 2021-11-14 03:36:10
how to make recursive function
// Basic Recursive function // It works in all languages but lets try with C // lets make a greedy strlen int my_recursive_strlen(int index, char *str) // note that index must be set at 0 to work in this case { if (str[index] == '\0') return index... Add solution -
PHP 2021-11-13 00:52:09
remove null values from array php
<?php $arr = array('1', '', '2', '3', '0'); // Incorrect: print_r(array_filter($arr)); // Correct: print_r(array_filter($arr, 'strlen')); //Custom print_r(array_filter($arr, function ($val) {if ($val > 0) {return true;} else {return false;}})); Add solution -
Other 2021-11-12 09:20:36
My favourite use of this function is converting a string to an array, trimming each line and removing empty lines:
<?php $array = array_filter(array_map('trim', explode("\n", $string)), 'strlen'); ?> Although it states clearly that array keys are preserved, it's important to note this includes numerically indexed arrays. You can't use a for loop on ... Add solution -
PHP 2021-11-10 13:09:16
php random string for filename
function generateRandomString($length = 25) { $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; $charactersLength = strlen($characters); $randomString = ''; for ($i = 0; $i < $length; $i++) { $rando... Add solution -
C 2021-11-10 07:09:07
string length in c
/** * A PROGRAM THAT RETURNS THE LENGTH OF A STRING FROM THE USER */ #include <stdio.h> /** * _strlen - takes a string and returns its length * @i: counter variable * @*s: the string entered by the user from the terminal * Return: Length of the st... Add solution