What do you want to save?
Add Code snippet
New code examples
-
C++ 2022-03-15 06:55:06
segment tree complexity
// C++ program to show segment tree operations like construction, query // and update #include <bits/stdc++.h> using namespace std; // A utility function to get the middle index from corner indexes. int getMid(int s, int e) { return s + (e -s)... Add solution -
Other 2022-01-24 00:55:53
dynamic array c
// Use malloc to allocate memory ptr = (castType*) malloc(size); int *exampl = (int*) malloc(sizeof(int)); // Use calloc to allocate and inizialize n contiguous blocks of memory ptr = (castType*) calloc(n, size); char *exampl = (char*) calloc(20, sizeof(c... Add solution -
Other 2021-11-20 07:40:20
how to print the file content each line in c
1 #include <stdio.h> 2 #include <stdlib.h> 3 #include <string.h> 4 5 int main(void) { 6 // ... 7 8 // "Empty" the string 9 line[0] = '\0'; 10 11 while(fgets(chunk, sizeof(chunk), fp) != NULL) { 12 ... Add solution -
Other 2021-11-08 08:02:15
malloc in c
// Use malloc to allocate memory ptr = (castType*) malloc(size); int *exampl = (int*) malloc(sizeof(int)); // Use calloc to allocate and inizialize n contiguous blocks of memory ptr = (castType*) calloc(n, size); char *exampl = (char*) calloc(20, sizeof(c... Add solution -
C++ 2021-11-05 03:52:08
how to allocate on heap in c++
#include <iostream> #include <string> using String = std::string; class Entity { private: String m_Name; public: Entity() : m_Name("Unknown") {} Entity(const String& name) : m_Name(name) {} const String& GetName() const ... Add solution -
C 2021-10-25 23:41:05
printf n characters c
// Use malloc to allocate memory ptr = (castType*) malloc(size); int *exampl = (int*) malloc(sizeof(int)); // Use calloc to allocate and inizialize n contiguous blocks of memory ptr = (castType*) calloc(n, size); char *exampl = (char*) calloc(20, sizeof(c... Add solution -
C 2021-10-19 05:58:16
malloc in c
// Use malloc to allocate memory ptr = (castType*) malloc(size); int *exampl = (int*) malloc(sizeof(int)); // Use calloc to allocate and inizialize n contiguous blocks of memory ptr = (castType*) calloc(n, size); char *exampl = (char*) calloc(20, sizeof(c... Add solution