What do you want to save?
Add Code snippet
New code examples
-
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 -
Other 2021-10-29 10:28:11
How do you move through a Huffman tree? Select one: a. 0 = right 1= left b. 1 = left 2 = right c. 0 = left 1 = right d. 0 = middle 1 = back
// Huffman Coding in C++ #include <iostream> using namespace std; #define MAX_TREE_HT 50 struct MinHNode { unsigned freq; char item; struct MinHNode *left, *right; }; struct MinH { unsigned size; unsigned capacity; struct MinHNode **... Add solution -
C 2021-10-28 18:01:11
how to dynamically allocate array size in c
// declare a pointer variable to point to allocated heap space int *p_array; double *d_array; // call malloc to allocate that appropriate number of bytes for the array p_array = (int *)malloc(sizeof(int)*50); // allocate 50 ints d_array = (int ... 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-20 02:28:05
initialize char pointer c
//you should probably use dynamic memory allocation //this string is uninitialized and will cause errors char *str1; //this string is initialized, but you would have to come up with text //I would highly discourage using this method char *str2 = "Du... 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